Hi all,
I am a beginner at coding and trying to write an percentage SL indicator of MA at mql4. The percentage (double) and MA period (int) will be changable. I take the percentage But i couldnt make it act as SL. Could anyone help me?
I want it act as picture.
Thanx
P.S: computer is not with me so i couldnt post the code that i wrote. I will do when i can ASAP.
Files:
9EE8EBCD-6E15-47F9-A9C8-739BE5051490.jpeg
317 kb
- Set TP the same as the SL distance?
- Close All pending order, When one order take the SL
- MQL4 - Trying to add lot size as percentage of margin to EA
Exphantom:
Hi all,
Hi all,
I am a beginner at coding and trying to write an percentage SL indicator of MA at mql4. The percentage (double) and MA period (int) will be changable. I take the percentage But i couldnt make it act as SL. Could anyone help me?
I want it act as picture.
Thanx
P.S: computer is not with me so i couldnt post the code that i wrote. I will do when i can ASAP.
ok.
//+------------------------------------------------------------------+ //| HaskayafxTakeProfitEAV01.mq4 | //| Copyright 2018, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2018, MetaQuotes Software Corp." #property link "https://www.haskayabilgi.com" #property version "1.00" #property strict input int MA=632; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- StopUdate(); } //+------------------------------------------------------------------+ int StopUdate() { int total = OrdersTotal(); bool tck; double SLNew=iMA(NULL,0,MA,0,MODE_SMA,PRICE_CLOSE,0); SLNew=NormalizeDouble(SLNew,Digits); for(int i=total-1;i>=0;i--) { tck= OrderSelect(i, SELECT_BY_POS); int type = OrderType(); bool result = false; if(OrderSymbol()==Symbol()) tck=OrderModify(OrderTicket(),OrderOpenPrice(),SLNew,OrderTakeProfit(),0,CLR_NONE); } return(0); }
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