Simple Coding Help - No Promise.

LoneWolf

Well-Known Member
Dear all coders,

I want this little help..

prevHigh = TimeframeGetPrice("H", inDaily, -1);

This line gives the previous day High. Can we see which bar in 30m chart makes this high ?? Lets say my default chart is 30M, can I find out which 30M bar yesterday makes this high to register the previous day High ??

Can I extract the barIndex, O, H, L, C and Volume for that particular 30m bar ??
 

amitrandive

Well-Known Member
hi dear amitrandive
thanks for your answring.i read your attachment.will plz add scan the value of schaff.and if schaff cross above 25 buy and if cross down 75 sell. waiting for your kind.thanks
Code:
_SECTION_BEGIN("schaff");
MA1=23;
MA2=50;
TCLen=10;
MA1=Param("ShortMACDLen",23,5,36);
MA2=Param("LOngMACDLen",50,10,100);
TCLen=Param("TCLen(StochPeriod)",10,5,20);
Factor=.5;
//Calculate a MACD Line
XMac = MACD(MA1,MA2) ; // MACD in Amibroker always uses Close for MACD calculation
 
//1st Stochastic: Calculate Stochastic of a MACD
Value1 = LLV(XMac, TCLen);
Value2 = HHV(XMac, TCLen) - Value1;
 
//Frac1=1; // prime Frac1 to a default of 1
//Frac1 = IIf(Value2 > 0, ((XMac - Value1) / Value2) * 100, Ref(FRAC1,-1));
// have to "prime" first value so that reference to "i-1" does not result in subscript out of range
// since MACD for both periods is not defined until MA2 period, 0 seems to be mathematically correct priming value
frac1=0;
for (i = 1; i < BarCount; i++) {
if (Value2[i] > 0) {
    frac1[i] = ((XMac[i] - Value1[i])/Value2[i])*100;
    }
else {
    frac1[i]= frac1[i-1];
    }
}
 
//Smoothed calculation for %FastD of MACD
 
PF[0]=frac1[0]; 
PF[1]=frac1[1];
for (i = 2; i < BarCount; i++) {
    PF[i]=PF[i-1]+(Factor*(frac1[i]-PF[i-1]));
}
 
 
//2nd Stochastic: Calculate Stochastic of Smoothed Percent FastD, above.
Value3 = LLV(PF, TCLen);
Value4 = HHV(PF, TCLen) - Value3;
 
//%FastK of PF
/*
Frac2=1;
Frac2 = IIf(Value4 > 0, ((PF - Value3) / Value4) * 100, Ref(FRAC2,-1));
*/
 
frac2[0]=0;
for (i = 1; i < BarCount; i++) {
    if (Value4[i] > 0 ) {
        frac2[i]=((PF[i] - Value3[i])/Value4[i])*100;
    }
    else {
        frac2[i]=frac2[i-1];
    }
}
 
//Smoothed calculation for %FastD of PF
PFF[0]=frac2[0];
PFF[1]=frac2[1];
for (i = 2; i < BarCount; i++) {
    PFF[i]=PFF[i-1]+(Factor*(frac2[i]-PFF[i-1]));
}
 Buy=Cross(pff,25);
 Sell=Cross(75,pff);
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorBlue, colorPink ), 0, IIf( Buy, Low, High ) );
Plot(pff,"STLC",colorRed,styleLine);
Plot(75,"",colorBlue,styleLine|styleDashed);
Plot(25,"",colorYellow,styleLine|styleDashed);
Filter=Buy OR Sell;
AddColumn(IIf(Buy,BuyPrice,Null)," Buy Signal ", 6.2,1.2,colorGreen); 
AddColumn(IIf(Sell,SellPrice,Null)," Sell Signal ",6.2,1.2,colorOrange);
AddColumn(Close,"Close");
_SECTION_END();
 
Yes, it is possible in Amibroker. There are few AFL functions that start with word TimeFrame and all of them deal with this kind of ideas. Look at examples.

Actual coding requires fair amount of debugging depending on exact requirement.
sir pls help me with exploration i have some few very basic question pls if anybody can give me his cell number or email id to ask something regarding amibroker scanning ...please

1. i just want multi time frame AFL for rsi above 70 and below 30

2. i want to scan in amibroker in 15 mint or 30 mint time frame in real time

3. is it possible for rsi to scan in multi time frame in live market
'and i i have realtime time data subscription from rtds data
 
Hi Ocil,

I need to find the 3-9 months high detection afl, 1-3 years high detection afl and "2x/3x/4x/5x Accumulation volume" which is similar to T3B. Appreciate you help sir.
 
Hi mm,
Did you done it with two timeframe before?

If there's condition used Bar30 and Bar60
Which condition will be true if you want arrow after candlestick complete?
PlotShapes( IIF( Bar30 AND Bar60, shapeUpArrow , shapeNone ), colorAqua );

or you do need?

PlotShapes( IIF( Bar30==1 AND Bar60==1, shapeUpArrow , shapeNone ), colorAqua );

or you need something else?





2. If you're comparing three timeframe, Can you use expandPoint in it?

that's all

regards
What does Bar30 and Bar60 represent. If you so wish, Post your code here and I may be able to comment on it after reading thru it.

expandPoint is useful in very narrow circumstances. Don't waste your time on it now.
 
Last edited:
Dear Sir

I want sum modification for the below code sir

SetBarFillColor(IIf(C > O, GetChartBkColor(), colorRed));
Plot( C, "Close", IIf(C > EMA(C,50), colorGreen, colorRed), styleCandle | styleNoTitle);

condition 1. ema close 50 above buy signal with backgroud colour green buy candle above only buy signal Generate

condition 2. ema close 50 below sell signal with backgroud colour red sell candle below only sell signal Generate

condition 3. suppose buy signal Generate only backgroud green and last candle high broken only generate

condition 4. suppose buy/sell signal generate bckground red but candle green
no generate the signal

waiting for your reply

thanks and regards
 

Similar threads