Requests & Ideas (MQL5 only!) - page 4

 
Vladimir Karputov:

About the "Pending distance" I understood. It turns out that a pending order is a top-up (increase) of a position?


Yes, it's a top up, and I am glad you did this: (InpPriceLevel     = 0;           // (in pips) <0 -> Stop orders, =0 -> Market, >0 -> Limit orders)

Everything looks fine so far, I will backtest and follow the chart to see if its trading accordingly, 

 

Hello friends,

I am looking for EA that moves SL to break even at a set target price while also closing 1/3 of my position at that price (so it does 2 things at once) and then close another 1/3 at a different target price keeping the same SL in place.  Does anyone know of an EA for work for MT5? thank you

 
kxj999:

Hello friends,

I am looking for EA that moves SL to break even at a set target price while also closing 1/3 of my position at that price (so it does 2 things at once) and then close another 1/3 at a different target price keeping the same SL in place.  Does anyone know of an EA for work for MT5? thank you


Apply search in the website (the window of search is on the right above) in such phrases: "moves SL" and "break even".


 
Vladimir Karputov:

Apply search in the website (the window of search is on the right above) in such phrases: "moves SL" and "break even".



I already search this and what I found those that are similar are for mt4 only and none for mt5.  That is why I am posting here for any help appreciated
 
ITM7:


Yes, it's a top up, and I am glad you did this: (InpPriceLevel     = 0;           // (in pips) <0 -> Stop orders, =0 -> Market, >0 -> Limit orders)

Everything looks fine so far, I will backtest and follow the chart to see if its trading accordingly, 


What results?
 
Vladimir Karputov:

Crossing of two iMA version   "1.003".

So far such functions work:

  • lot is calculated as risk percent from balance
  • we find crossing and we open on the market (without the pending orders)


Good day Vladimir, 

Lot size is working fine, 

I back tested the EA and paid attention at the crossing points. I noticed that the positions are being opened before the lines cross. I tried it on the demo account on a 5M time frame to observe the crossings more quickly but the same thing happened.

I thought it was the price values of the MAs like closing, opening price etc. but there is no problem with that. 

The EA is not waiting until the birth of a new bar, it opens position even if the lines have not crossed. I have attached some pictures that explains what I am trying to say, I captured them while backtesting and the same thing is happening when I forward test on the demo account   

I tried to follow the code of the EA, I could not see what was wrong although I did not understand everything, 

I searched the codes of some EAs that mention crossing of MAs and I came across this link in one of them which was very helpful.  : https://book.mql4.com/samples/indicators 

Under " Stochastic Oscillator " at https://book.mql4.com/samples/indicators , is the same thing that must happen when the lines cross but I don't know how to apply that code to the EA in MT5, the code is for MT4 and it seems like the iMA functions are not working the same in MT4 and MT5

Ragards

Usage of Technical Indicators - Simple Programs in MQL4 - MQL4 Tutorial
Usage of Technical Indicators - Simple Programs in MQL4 - MQL4 Tutorial
  • book.mql4.com
Usage of Technical Indicators - Simple Programs in MQL4 - MQL4 Tutorial
 
ITM7:




"Missed_signal_and_premature_position_entry.png " - What were the parameters? Screenshot from the Strategy Tester, the "Inputs" tab
 
Vladimir Karputov:

"Missed_signal_and_premature_position_entry.png " - What were the parameters? Screenshot from the Strategy Tester, the "Inputs" tab

Input parameter screen shot attached
Files:
 

I will try to explain:

there is no crossing

crossing is

I will think over the good solution of this problem.

 

Yes, it works!

Crossing of two iMA 1.004:

Crossing of two iMA 1.004

I have applied two-level check of a perpesecheniye.

//--- step 1: check in the arrays bars [0] and [1]
   if(First[0]>Second[0] && First[1]<Second[1]) // buy
     {
      if(!RefreshRates())
        {
         PrevBars=iTime(1);
         return;
        }
      double sl=m_symbol.Bid()-InpStopLoss*m_adjusted_point;
      double tp=m_symbol.Ask()+InpTakeProfit*m_adjusted_point;
      OpenBuy(sl,tp);
      return;
     }
   else if(First[0]<Second[0] && First[1]>Second[1]) // sell
     {
      if(!RefreshRates())
        {
         PrevBars=iTime(1);
         return;
        }
      double sl=m_symbol.Ask()+InpStopLoss*m_adjusted_point;
      double tp=m_symbol.Bid()-InpTakeProfit*m_adjusted_point;
      OpenSell(sl,tp);
      return;
     }
//--- step 2: on a step of 1 crossing haven't found. check in the arrays bars [0] and [2]
   if(First[0]>Second[0] && First[2]<Second[2]) // buy
     {
      if(!RefreshRates())
        {
         PrevBars=iTime(1);
         return;
        }
      double sl=m_symbol.Bid()-InpStopLoss*m_adjusted_point;
      double tp=m_symbol.Ask()+InpTakeProfit*m_adjusted_point;
      OpenBuy(sl,tp);
      return;
     }
   else if(First[0]<Second[2] && First[1]>Second[2]) // sell
     {
      if(!RefreshRates())
        {
         PrevBars=iTime(1);
         return;
        }
      double sl=m_symbol.Ask()+InpStopLoss*m_adjusted_point;
      double tp=m_symbol.Bid()-InpTakeProfit*m_adjusted_point;
      OpenSell(sl,tp);
      return;
     }
  }
Files:
Reason: