help drawing this rectangle
heyarn:
Someone please help :)
Hi Everyone,
Please help me draw this. This is intended for my EA and not as an indicator. Not sure why it is not drawing.. I just want for there to be a box which starts at hour 1 of the day and ends at hour 5. LineA and LineB will be the high and low of the first 5 hours of the day.
Thanks in advance!
try this
extern string ScanStartTime = "01:00"; extern string ScanEndTime = "05:00"; extern color BoxColor = Yellow; #define BOX "heyarnBox" void deinit() { ObjectDelete(BOX); } void start() { datetime t = TimeCurrent(), tBoxLeft = StrToTime(TimeToStr(t, TIME_DATE) + " " + ScanStartTime), tBoxRight = StrToTime(TimeToStr(t, TIME_DATE) + " " + ScanEndTime); if(tBoxRight < tBoxLeft) tBoxRight+=PERIOD_D1*60; int iBoxLeft = iBarShift(NULL, 0, tBoxLeft, true) + 1, iBoxRight = iBarShift(NULL, 0, tBoxRight, true); if(iBoxRight == -1) iBoxRight = iBarShift(NULL, 0, Time[0]); double dBoxTop = High[iHighest(NULL, 0, MODE_HIGH, iBoxLeft-iBoxRight, iBoxRight)], dBoxLow = Low [iLowest (NULL, 0, MODE_LOW , iBoxLeft-iBoxRight, iBoxRight)]; ObjectDelete(BOX); if((t > tBoxLeft) && (t < tBoxRight)) { ObjectCreate(BOX, OBJ_RECTANGLE, 0, tBoxLeft, dBoxTop, tBoxRight, dBoxLow); ObjectSet(BOX, OBJPROP_COLOR, BoxColor); ObjectSet(BOX, OBJPROP_BACK, false); } }
sxTed:
try this
I really appreciate it sxTed! I'll try it when I get home.
Hi Everyone,
Please help me draw this. This is intended for my EA and not as an indicator. Not sure why it is not drawing.. I just want for there to be a box which starts at hour 1 of the day and ends at hour 5. LineA and LineB will be the high and low of the first 5 hours of the day.
Thanks in advance!