Dear Senior,
Need you help.
Once buy signal triggered as per Buy, once it breaks low range ( 3 min ), then 1 sell and 1 short required and if price then price moves upward and break high range ( 3 min ) then 1 cover and 1 buy required.
I am unable to make that happen.
Your guidance is highly solicited.
_SECTION_BEGIN("Settings");
paraIntraExitTime = ParamTime("Intraday Exit Time", "15:15:00");
_SECTION_END();
_SECTION_BEGIN("Trade");
orb = ParamList("ORB Range", "1min|3min",1);
newday = Day() != Ref(Day(),-1); //check if new day or not
starttime = ValueWhen(newday,TimeNum());
//1min ORB
if(orb == "1min")
{
IBendtime = starttime+100;
minh = ValueWhen(newday,TimeFrameGetPrice("H",in1Minute));
minl = ValueWhen(newday,TimeFrameGetPrice("L",in1Minute));
}
//3min ORB
if(orb == "3min")
{
IBendtime = starttime+300;
minh = ValueWhen(newday,TimeFrameGetPrice("H",in1Minute*3));
minl = ValueWhen(newday,TimeFrameGetPrice("L",in1Minute*3));
}
printf("%g",IBendtime);
DayOpen = TimeFrameGetPrice("O",inDaily);
DayHigh = TimeFrameGetPrice("H",inDaily);
DayLow = TimeFrameGetPrice("L",inDaily);
ORBH = IIf(TimeNum() < IBendtime, Null ,minh);
ORBL = IIf(TimeNum() < IBendtime, Null, minl);
Plot(ORBH,"ORBH",colorBlue);
Plot(ORBL,"ORBL",colorRed);
de = Day();
de1 = Ref(de, -1);
FC = de != de1;
C1 = Ref(C, -1);
O1 = Ref(O, -1);
C2 = Ref(C, -2);
O2 = Ref(O, -2);
intraExitCond = TimeNum() >= paraIntraExitTime;
BuyCond1 = FC AND C > Max(C1, O1) AND O > Max(C1, O1) ;
BuyCond2 = Ref(FC, -1) AND C >= Min(O1, C1) ;
BuyCond3 = Ref(FC, -2) AND C > O ;
Buycond4 = (Cross( Close, (ValueWhen(newday,TimeFrameGetPrice("H",in1Minute*3)))) )
ShortCond1 = FC AND C < Min(C1, O1) AND O < Min(C1, O1) ;
ShortCond2 = Ref(FC, -1) AND C <= Max(O1, C1) ;
ShortCond3 = Ref(FC, -2) AND C < O ;
Shortcond4 = (Cross((ValueWhen(newday,TimeFrameGetPrice("L",in1Minute*3))),Close ))
Buy = Ref(BuyCond1, -2) AND Ref(BuyCond2, -1) AND BuyCond3 ;
Short = Ref(ShortCond1, -2) AND Ref(ShortCond2, -1) AND ShortCond3;
Sell = Short OR intraExitCond;
Cover = Buy OR intraExitCond;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Short = ExRem(Short, Cover);
Cover = ExRem(Cover, Short);
BuyPrice = ValueWhen(Buy, C);
SellPrice = ValueWhen(Sell, C);
ShortPrice = ValueWhen(Short, C);
CoverPrice = ValueWhen(Cover, C);
PlotShapes(Buy * shapeUpTriangle, colorBlue, 0, L, -24);
PlotShapes(Short * shapeDownTriangle, colorOrange, 0, H, -24);
_SECTION_END();
_SECTION_BEGIN("Explore");
Filter = Buy OR Short ;
AddColumn(IIf(Buy, C, Null), "Buy", 1.2, colorWhite, colorDarkGreen, 115);
AddColumn(IIf(Short, C, Null), "Short", 1.2, colorWhite, colorDarkRed, 115);