Simple Coding Help - No Promise.

Thanks a lot HappySinghji,

Just one more doubt ... maybe I am missing something or not understanding ..

In the pic ... the colors changed @ 14:30:59 candle time whereas scanner shows the next candle ...

Any mistake in my data or time value or am I running the scanner wrongly ..



Thanks
 

chintan786

Well-Known Member
Happy Ji,
thanks for your prompt reply.
For your reference, plz go through below link:
http://www.i n d i trader s.com/journals/11207-my-experiments-trading-3.html

This is what I am looking for.
thanks in advance
Here is the condition need to mate:
Take 5-day simple moving average of Open, High, Low and Close.
2) Plot these averaged Open, High, Low and close as candles. (PlotOHLC() function in Amibroker).
3) Calculate the Difference between the averaged High and averaged Low and plot the 5-day simple moving average of this difference (use ownscale parameter for this plot). I refer to this line as H-L line
4) Mark Peaks and troughs on the chart. A peak is defined here as the high of the modified candle which is higher than the highs of the two candles before and two candles afterwards. Similarly, the trough is low of the candle which is lower than the lows of two candles before and two candles after.
 

chintan786

Well-Known Member
Here is the condition need to mate:
Take 5-day simple moving average of Open, High, Low and Close.
2) Plot these averaged Open, High, Low and close as candles. (PlotOHLC() function in Amibroker).
3) Calculate the Difference between the averaged High and averaged Low and plot the 5-day simple moving average of this difference (use ownscale parameter for this plot). I refer to this line as H-L line
4) Mark Peaks and troughs on the chart. A peak is defined here as the high of the modified candle which is higher than the highs of the two candles before and two candles afterwards. Similarly, the trough is low of the candle which is lower than the lows of two candles before and two candles after.
Plot(MA(Close,5), "Shifted MA", colorRed, styleCandle, Null, Null, 5 );
 
Did Bar Replay .. but didn't understand why its happening ...
:confused:
the color change is happening on next bar only . . . .

The HTF signal is expanded onto the lower time frame . . .
so we have to wait for the current bar to close . . .

Check again you may notice it . . .

if still confused, can trade directly using the OBV chart . . .


Happy :)
 
Here is the condition need to mate:
Take 5-day simple moving average of Open, High, Low and Close.
2) Plot these averaged Open, High, Low and close as candles. ( function in Amibroker).

3) Calculate the Difference between the averaged High and averaged Low and plot the 5-day simple moving average of this difference (use ownscale parameter for this plot). I refer to this line as H-L line


4) Mark Peaks and troughs on the chart. A peak is defined here as the high of the modified candle which is higher than the highs of the two candles before and two candles afterwards. Similarly, the trough is low of the candle which is lower than the lows of two candles before and two candles after.

Code:
Op = MA(O,5);	Hi = MA(H,5);	Lo = MA(L,5);	Cl = MA(C,5);	e = MA(Hi-Lo,5);
PlotOHLC(Op,Hi,Lo,Cl,"",colorDefault,styleCandle);

PK = Ref(Hi,-4) < Ref(Hi,-3) AND  Ref(Hi,-3) < Ref(Hi,-2) AND Ref(Hi,-2) > Ref(Hi,-1) AND Ref(Hi,-1) > Hi;
TR = Ref(Lo,-4) > Ref(Lo,-3) AND  Ref(Lo,-3) > Ref(Lo,-2) AND Ref(Lo,-2) < Ref(Lo,-1) AND Ref(Lo,-1) < Lo;

PlotShapes(PK*2,colorWhite,0,Hi);		
PlotShapes(TR*1,colorWhite,0,Lo);

// THIS NEXT 2 LINES OF CODE LOOKS INTO FUTURE
PlotShapes(Ref(PK,2)*21,colorWhite,0,Hi,12);
PlotShapes(Ref(TR,2)*21,colorWhite,0,Lo);

// BEST TO PLOT THIS ON A SEPERATE PANE
Plot(MA(Hi-Lo,5),"",colorRed,styleOwnScale);
Please do not come up with any more change requests for this code . . . .

Happy :)
 
Last edited:

Similar threads