Michael Musin:
Post your code properly please. Use the code button, edit your post, do not repost.
Can anyone help me to code this code correctly?
I need a string variable and still don't quite understand how to do it.
void OnTick() { for(int i = 0; i <= 5; i++) { double high = iHigh(_Symbol,PERIOD_D1,i); double low = iLow(_Symbol,PERIOD_D1,i); string name_high = "high" + i; string name_low = "low" + i; ObjectDelete(ChartID(),name_high); ObjectDelete(ChartID(),name_low); ObjectCreate(ChartID(), name_high, OBJ_HLINE ,0,0, high); ObjectCreate(ChartID(), name_low, OBJ_HLINE,0,0, low); } }
Michael Musin:
Can anyone help me to code this code correctly?
I need a string variable and still don't quite understand how to do it.
What are you trying to achieve ?
If you want each line to be unique and not only care about the most recent 5 bars then do the naming with Time as Dominik suggested.
Otherwise you don't need to update all of them on each tick (i assume its on tick) , just update the live one and if a new bar forms redesign them.
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
Can anyone help me to code this code correctly?
I need a string variable and still don't quite understand how to do it.
...
...