Hello I want to add a condition to my purchase code. my buy code is as follows:
double ATRBuy = GetIndicatorValue (handleatr, 0,1);
I would like to add the following condition to this code. I use atr as the line with the following stop loss. Don't buy if the Atr indicator is 2% higher than the price.
how can I do that.
- Call ATR in EA
- [WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you.
- I don't want to show indicator in backtest
Kutluhan Yesilkaya:
Hello I want to add a condition to my purchase code. my purchase code is as follows: double ATRBuy = GetIndicatorValue (handleatr, 0,1);
I want to add the following condition to this code. Don't buy if the atr indicator is 2% higher than the price. how can I do that.
- Please post only in English on this forum. Use the automatic translation tool if needed. Use simple language structure when using mechanical translation. 2013.08.09
- ATR is the size of the bars. It will never be higher than price.
// i assume your code is MQL4 //add this before buy function: if(ATRBuy > Ask*(2+100)/100 )return;
Khuman Bakhramirad:
I forgot to specify. I am using metatrader 5
MqlTick latest_price; if(!SymbolInfoTick(_Symbol,latest_price)) return; double Ask = latest_price.ask; if(ATRBuy > Ask*(2+100)/100 )return;
then add this
Khuman Bakhramirad:
sonra bunu ekle
I HAVE TRIED THESE CODES. DOES NOT OPERATE AT ALL. I ONLY WANT IT NOT TO TRANSACTION IF THERE IS A 2% DIFFERENCE
sure because "Average True Range" is always lower than price because its the price changing range, but this is what you asked for :\ explain more what do you mean by ATR more than price, do you know what ATR is?
Kutluhan Yesilkaya: I want to add a condition to my purchase code.
Do you actually have code? Not a .EXn; real code? Then no one can help you; you didn't purchase the code.
William Roeder :
Gerçekten kodunuz var mı? .EXn değil; gerçek kod? O zaman kimse sana yardım edemez; kodu satın almadınız.
yes ı have got
Khuman Bakhramirad:
elbette çünkü " Ortalama Gerçek Aralık " her zaman fiyattan daha düşüktür çünkü fiyat değişim aralığıdır, ancak siz bunu istediniz: \ ATR ile fiyattan çok ne demek istediğinizi açıklayın, ATR'nin ne olduğunu biliyor musunuz?
elbette çünkü " Ortalama Gerçek Aralık " her zaman fiyattan daha düşüktür çünkü fiyat değişim aralığıdır, ancak siz bunu istediniz: \ ATR ile fiyattan çok ne demek istediğinizi açıklayın, ATR'nin ne olduğunu biliyor musunuz?
That's how I use the atrbuy line
Files:
Adsaz.png
19 kb
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