- Indicator that resets suddenly
- Please Help
- Multitimeframe indicator
EDIT your original post, please do not just post the code correctly in a new post.
Also please remove all the unnecessary empty lines, it will be easier for others to read.
EDIT your original post, please do not just post the code correctly in a new post.
Also please remove all the unnecessary empty lines, it will be easier for others to read.
void OnEveryTick1() { int i; int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1);I tried debug your code, the issue lies here
if(counted_bars < 0) return(-1);
A void function should not return any value except void.
I think it would help with the issue if the -1 is removed
if(counted_bars < 0) return;
2nd issue:
i = Bars - counted_bars;
Fix:
i = Bars - counted_bars -1;
3rd issue:
Zero division error, I will leave it to you.
void ChartLine2()
{
Buffer2[current]= Buffer3[current]/ Buffer4[current];
}
You can always see the error code from the Terminal > Expert and learn to fix them one by one.
Thank you so much, now no warnings in the compilation
Searching in the forum i find this and works ok
from this
void ChartLine2()
{
Buffer2[current]= Buffer3[current]/ Buffer4[current];
}
To this
void ChartLine2() { if(Buffer3[current]>0) if(Buffer4[current]>0) Buffer2[current]= Buffer3[current]/ Buffer4[current]; }
Hi, I'm new to programming, so far I have been able to overcome everything but I have been blocked for a month. the indicator stops working for me and I think this is when I try to split 2 buffers. I would be very grateful if you can help me I put a code that does not work for me
int init() { if (false) ObjectsDeleteAll(); // clear the chart IndicatorShortName("Indicator name"); IndicatorDigits(Digits+1); IndicatorBuffers(3); SetIndexBuffer(0, Buffer4); SetIndexBuffer(1, Buffer3); SetIndexBuffer(2, Buffer2); SetIndexStyle(2, DRAW_LINE, STYLE_SOLID); SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); SetIndexEmptyValue(2,0.0); return(0); } void ChartLine2() { if(Buffer3[current]!=EMPTY_VALUE && Buffer4[current]!=EMPTY_VALUE && Buffer4[current]!=0) Buffer2[current]= Buffer3[current]/ Buffer4[current]; } }
many Thanks
now work perfect
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use