Hi guys,
I have to implement a simple system.
I have to generate signal for IB break when market opens beyond the yesterday range.
I have implemented the IBH, IBL, PDH, PDL values.
_SECTION_BEGIN("IB High Low");
tn = TimeNum();
// define start/end hours in TimeNum format
StartTime = 091500;
Endtime = 100000;
// these conditions are true when TimeNum of the bar equals startime/endtime
StartBar = tn == StartTime;
EndBar = tn == Endtime;
// on the end bar we read the value of highest high or lowest low since the start bar
IBH = ValueWhen( EndBar, HighestSince( StartBar, High ) );
IBL = ValueWhen( EndBar, LowestSince( StartBar, Low ) );
PDH = TimeFrameGetPrice("H",inDaily,-1);
PDL = TimeFrameGetPrice("L",inDaily,-1);
CDO = ValueWhen(Day()!=Ref(Day(),-1),O); /*current day open. All values are successfully captured till here. */
Openn = IIf( ( CDO > PDH OR CDO < PDL) , 1, 0 );
{
GfxTextOut( "Openn : " + Openn, 10,120);
}
/*Signal generation part below*/
Buy = Cross(H,IBH);
Sell = Cross(IBL,L);
Short = Sell;
Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Cover=ExRem(Cover,Sell);
Sell=ExRem(Sell,Cover);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
Filter = Buy OR Sell;
_SECTION_END();
I have to generate a signal when current day IBH or IBH breaks only when current day open is beyond yesterday's range.
i.e. values used will be IBH, IBL, CDO, PDH and PDL.
I know it is very simple but I am not getting the function to combine this condition.
Kind support is much appreciated.
Thank you for the cooperation.
-Nandkishor