That is code for an indicator.
int limit = prev_calculated - 1; double maxH, minL; int i; //--- create the texts i = limit; if(!TextCreate( 0, "TextHigh_"+(string)i, 0, time[i], high[i], DoubleToString(high[i],5), TextFont, TextFontSize, TextColor, TextAngle, TextAnchor, TextBack, TextSelection, TextHidden, TextZOrder)) { Print("Error creating text."); }
What does it say in the Experts tab?
Probably you are getting a fatal error "Array out of range"
When the indicator starts
prev_calculated=0
so
limit=-1
i=-1
time[-1] etc does not exist
if(!TextCreate( 0, "TextHigh_"+(string)iDon't use indexes in object names. When the next bar forms you will already have a object named TextHigh_0. Always use Time[i]
@WHRoeder I'm not sure what you're saying. Thanks @GumRai, that worked!
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
The original code works except when you add
where it's shown in the above code. The debugger won't step into that if condition / function call. So I can't look any further. Any ideas why it's crashing?