Forum

Custom indicator not working

Hi everyone I am trying to plot a price range with ATR and MA indicator. Here is my code and I receive no error or warning. But lines do not appear in the chart. Anyone has a clue? int Countrd_bars=prev_calculated; for ( int i=rates_total-Countrd_bars- 1 ;i>= 0 ;i--) {

Trailing stop does not work on Sell position

Hi, Everyone, I'm getting error whenever I'm starting Strategy Tester . The problem is that Trailing stop works on Buy signals but it does not work on Sell signals. When I place TP and SL in sell OrderSend code everything is fine and automated system works. But I want to activate Trailing stop on

How to extract values form for function and create an array

Hello all I want to create an array from 9 values and then measure mean of the array. I used the Operator 'for' but I do not know how to extract values from it. want to do is to extract these trmax values from the loop and use it out of the loop. Any idea how to do so? Here is my code: for ( int i=

Changing NaN values not working

Hello all I looked on past posts here and elsewhere, tried, tried and tried but still I am stuck. Can anyone lend a hand? I want to change NaN values with zero. This is simply my code: double a= 5 ; double b= 0 ; double c=a/b; if ( MathIsValidNumber (c)) c=c;

How to count 9 previous bars in MQL4?

Hi Sorry I am new to MQL4 and trying to understand it I would like to sum open values of 9 previous bars. I confused using Bars of iBars. Anyone has a clue? Thanks