
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I also find it strange. Everything seems perfect and the code looks solid from drawings to the supporting function but for some reason, the boxes won't move with price.
prev_calculated in
seems to be isolated from
and
When I count forward (i++) in and indicator loop and return rates_total from OnCalculate(), I always reference prev_calculated--albeit through a variable. In your code, it appears that lastProcessedBar is such a variable.
prev_calculated in
seems to be isolated from
and
When I count forward (i++) in and indicator loop and return rates_total from OnCalculate(), I always reference prev_calculated--albeit through a variable. In your code, it appears that lastProcessedBar is such a variable.
Honestly am stuck what do you suggest I do here. I have been going round in circles missing trades because I can't ficus on the charts being at woke and coming to finish the code which won't allow me to complete it.
I copied your code and did this:
and it did not fix the rectangle cleanup.
Upon testing, the indicator draws multiple rectangles immediately upon loading but then deletes any rectangle that is breached by price. Therefore, the solution would seem to be to prevent immediate drawing of multiple rectangles.
Interestingly, I now see that there is no OnInit() event handler in the indicator. I didn't even know that an indicator could load without OnInit(). This can't be good.
I copied your code and did this:
and it did not fix the rectangle cleanup.
Upon testing, the indicator draws multiple rectangles immediately upon loading but then deletes any rectangle that is breached by price. Therefore, the solution would seem to be to prevent immediate drawing of multiple rectangles.
Interestingly, I now see that there is no OnInit() event handler in the indicator. I didn't even know that an indicator could load without OnInit(). This can't be good.
Yes the rectangles are the foundation of the indicator. Once broken they are deleted. So on loading you will see the once that are still valid within the lookback window period. As long as they all are valid they have to show until they are either invalidated by age or price action crosses and close beyond them. It loads perfectly well and seems lightweight no lags even without the OnInit() function. Execpet for the drawing part to keep up with new bars.
Ok. Thanks for confirming.
I'm still working on it...
I made a few more edits. I manually drew the blue vertical time line when the indicator loaded. Is this as intended?
I made a few more edits. I manually drew the blue vertical time line when the indicator loaded. Is this as intended?
You see the blue lines were once the last closed bars I think when you started the tester. Now a few bars have printed and the line and boxes stay behind not following the price on each closed candle.
I added 3 lines of code to your original code. The time1 line can be commented out or deleted. I left it in place merely for illustrative purposes.
hey sorry I wasnt in the charts today, caught up with day job. Definitely I will check this out and place on the charts too.
No worries.
I never really looked into fair value gaps until you posted this. Interesting.