ATR equal zero
APeng: ATR calculated for a shift bigger than about 8500 bars always results in zero. Do you have any ideas why and how to solve it?
double ATR = iATR(Symbol(),60,10,i);
- You have no PERIOD_H1 history that far back. Print iBars(Symbol(), PERIOD_H1) to verify.
- Download history.
- Write self documenting code, not hard coded numbers
double ATR = iATR(Symbol(),PERIOD_H1,10,i); double ATR = iATR(NULL,PERIOD_H1,10,i); // current pair, H1. double ATR = iATR(NULL,0, 10,i); // current pair, current TF.
WHRoeder:
- You have no PERIOD_H1 history that far back. Print iBars(Symbol(), PERIOD_H1) to verify.
- Download history.
- Write self documenting code, not hard coded numbers
Thanks!
You are right - iBars(Symbol(), PERIOD_H1) verifies it. Thought I have enough history as the chart shows candles.
Would you explain the advantage of the shown self documenting (even don´t know what that means?) code?
APeng: Would you explain the advantage of the shown self documenting (even don´t know what that means?) code?
So you will understand the code tomorrow. What does zero mean?| In ArrayCopySeries(), iHighest() and iLowest() functions. | MODE_OPEN |
| In timeframes | current chart |
| In OrderSend() | OP_BUY |
| In iMA, etc. | current pair or current TF or PRICE_CLOSE or MODE_SMA depending on which argument |
| In Drawing styles | DRAW_LINE |
| In Colors | Black |
| In iMACD(), iRVI() and iStochastic() | MODE_MAIN |
| In ObjectCreate(), ObjectsDeleteAll() and ObjectType() | OBJ_VLINE |
| In UninitializeReason() | Script returned from start |
| From GetLastError() | ERR_NO_ERROR |
That's no where near complete.
Do you really expect to remember what each value means. Will you remember 2 months from now?
WHRoeder:
So you will understand the code tomorrow. What does zero mean?
that makes sense, thank you :)
So you will understand the code tomorrow. What does zero mean?
| In ArrayCopySeries(), iHighest() and iLowest() functions. | MODE_OPEN |
| In timeframes | current chart |
| In OrderSend() | OP_BUY |
| In iMA, etc. | current pair or current TF or PRICE_CLOSE or MODE_SMA depending on which argument |
| In Drawing styles | DRAW_LINE |
| In Colors | Black |
| In iMACD(), iRVI() and iStochastic() | MODE_MAIN |
| In ObjectCreate(), ObjectsDeleteAll() and ObjectType() | OBJ_VLINE |
| In UninitializeReason() | Script returned from start |
| From GetLastError() | ERR_NO_ERROR |
That's no where near complete.
Do you really expect to remember what each value means. Will you remember 2 months from now?
Hi Guys,
ATR calculated for a shift bigger than about 8500 bars always results in zero. Do you have any ideas why and how to solve it?
wrote this code to check it:
Thank you for any hint!