Fix my EA & trailing step

MQL4 전문가

작업 종료됨

명시

Please have good communication, reply to comments, and have attention to detail.

Have expert I need help with. EA's pretty much working except for trail orders*.

All trail inputs

extern   bool TrailByATR              = true;
extern   bool TrailByMAHL               = true;
extern   bool SpreadStopAtHalfRisk    = true;
input double TrailDefaultRisk = 250;

The trail module*

void TrailOrders()
 {
 //+-----------------------------------------------------------------|| 
 for(int intCntr=OrdersTotal(); intCntr>0; intCntr--)
  {
  if( !OrderSelect(intCntr,SELECT_BY_POS,MODE_TRADES) ){ continue; }
  if( !OrderMagicNumber()==intMagic() ){ continue; }
  //-
  switch(OrderType())
   {
   case OP_BUY:
    {//NormalizeDouble( OrderOpenPrice()-dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) ), Digits);
    //‌TrailBack
    double spread=Ask-Bid;
    double stoploss=OrderStopLoss();
    double openprice=OrderOpenPrice();
    if( Ask-(spread)<=stoploss && stoploss>=openprice-(TrailDefaultRisk*Point) && 
        stoploss!=Ask-(spread) ){ ModifyStop( Ask-(spread) ); }
    //ResetTrail
    if( Ask>=OrderOpenPrice()-dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) ) &&
        stoploss<OrderOpenPrice()-dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) )
      ){ ModifyStop( OrderOpenPrice()-dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) ) ); }
    //SpreadProfit
    if( Ask-openprice>=dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) )/2 &&
        stoploss<openprice+(Ask+Bid)
      ){ ModifyStop( openprice+(Ask-Bid) ); }
    //TrailRiskToReward
    if( Ask-stoploss>dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) )*2
      ){ ModifyStop( Ask-dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) )*2 ); }
    }
   break;
   case OP_SELL:
    {//NormalizeDouble( OrderOpenPrice()+dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) ), Digits);
    //‌TrailBack
    double spread=Ask-Bid;
    double stoploss=OrderStopLoss();
    double openprice=OrderOpenPrice();
    if( stoploss>=Bid+(spread) && stoploss<=openprice+(TrailDefaultRisk*Point) && 
        stoploss!=Bid+(spread) ){ ModifyStop( Bid+(spread) ); }
    //ResetTrail
    if( Bid<=OrderOpenPrice()+dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) ) &&
        stoploss>OrderOpenPrice()+dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) )
      ){ ModifyStop( OrderOpenPrice()+dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) ) ); }
    //SpreadProfit
    if( OrderOpenPrice()-Bid>=dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) )/2 &&
        stoploss>OrderOpenPrice()-(Ask+Bid)
      ){ ModifyStop( OrderOpenPrice()-(Ask-Bid) ); }
    //TrailRiskToReward
    if( stoploss-Bid>dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) )*2
      ){ ModifyStop( Bid+dRiskAmt( iBarShift(strSymbol,intPeriod,OrderOpenTime()) )*2 ); }
    } 
    break;
   }
  }
 //+-----------------------------------------------------------------||
 }
//+-----------------------------------------------------------------//
void ModifyStop(double dblStop) 
 {
 for(int iRetries=Retries; iRetries>0; iRetries--)
  {
  while(IsTradeContextBusy() && !IsStopped()){Sleep(100);}
  if( OrderModify(OrderTicket(),OrderOpenPrice(),dblStop,OrderTakeProfit(),0,CLR_NONE) )
   { return; }
  }
 //-
 }

The risk module( risk and indicators are working fine. )

double dRiskAmt(int bar)
 {
 //+-----------------------------------------------------------------||
 double TotalRisk=0;
 double RiskAmt=0;
 if( !TrailByMAHL && !TrailByATR )
  {
  if( ( TrailDefaultRisk*Point )>( (Ask-Bid)*3 ) )
       { TotalRisk+=( TrailDefaultRisk*Point ); }
  else { TotalRisk+=( (Ask-Bid)*3 ); }
  }
 else
  {
  if( TrailByMAHL )
   { 
   RiskAmt=dblMAHL(bar);
   if( RiskAmt>( TrailDefaultRisk*Point ) ){ TotalRisk+=( TrailDefaultRisk*Point ); }  //too high  
   else if( RiskAmt<( (Ask-Bid)*3 ) )      { TotalRisk+=( TrailDefaultRisk*Point ); }  //too low
   else                                    { TotalRisk+=RiskAmt; }
   }
  if( TrailByATR )
   { 
   RiskAmt=dblATR(bar);
   if( RiskAmt>( TrailDefaultRisk*Point ) ){ TotalRisk+=( TrailDefaultRisk*Point ); }  //too high
   else if( RiskAmt<( (Ask-Bid)*3 ) )      { TotalRisk+=( TrailDefaultRisk*Point ); }  //too low
   else                                    { TotalRisk+=RiskAmt; }
   }
  }
 if( TotalRisk==0 ){ TotalRisk+=( TrailDefaultRisk*Point ); }
 //+-----------------------------------------------------------------||
 return(TotalRisk);
 }
비슷한 주문
I'm looking for professional developer for long term. Who have skill in Converting trading to MT4/5. Also have good knowledge of Algo. And response and deliver tools on time and at the top need good communication. That's all we need
budget of 500 usd I want to create a rsi bot for eur usd money is the least important thing I want it to look good if you are going to apply do it but send me at least 3 photos or screenshots of this type of work with rsi bot my goal level 50 sell level 20 buy that's all it must have its basic robot functions
Hello, i would Like to convert my Ex4 file to mql4 file. The Expert Advisor is EX4 file convert it to mql4 file. I would like to add some exciting features on this EA like trailing stop loss, Take profit and stop loss to break even
Hi, Good mrng. I have an indicator, which creates some signals. I wanted to filter the unwanted signals generated there using just Candlestick Patterns Rules. All cases are highlighted in a clear manner with pics as well. https://docs.google.com/document/d/11soaICN7wDQRXbN8MDNbov9NbIo3xtpJ?rtpof=true&amp ;usp=drive_fs Please check the drive link for a proper word doc :) Condition 6: Avoid Early signals: True/False
I have simple EA i want to modify its parameters. If you are good at modifying EAs contact me for more details. I will issue the source code then you return after finishing without changing the buy or sell conditions
the code wasn't mine, i have got it somewhere on the web, but i like the performance of the EA, so i want to use it on mt5 platform. the given code based on price movements with ladder entry concept
* Advanced level dev only, NDA required * Hi, I have a multi timeframe, multiindicator expert that requires additional features added to it. First started development 5 years ago. Upgrading with new features. To be added Entry - Add Stochastic and CCI options for trade entry to be added to existing signal options. Add config options to existing menu Bulk Exit - Master switch for close all trades based on basket
I am developing a master EA that integrates several sub-EAs. The project is complex, and the documentation is thoroughly structured, spanning 50 pages with detailed step-by-step procedures. 1st sub-EA: This EA opens trades without using indicators. Instead, it opens a new trade based on the color or status of the last candle. For instance, if the last candle was green, a new buy trade is opened. 2nd sub-EA: This EA
Good Day I would like to order a trading robot. Pairs: XAUUSD (GOLD) EUR/USD USD/JPY The robot should be trading daily with TP/SL build in, would like to have trailing and stop loss, should execute up to 5 trades (preffarable setting choice) up to 10 trades Los sizes to be choise setting, must also trade major US vews events Like:US- PPI, CPI, NFP, Sales m/m and so on Must also show/display alert when opening
Hello Guys, I need a trading bot for the MT5 to place order based on my trading strategy which is based on - >> entry based on EMA with rejection from specific levels like support and resistance area - levels and time frame i will apply into the robot manually on daily basis. also need - trailing stoploss , shift to breakeven after gaining some points. need a highly expert developer

프로젝트 정보

예산
21 - 89 USD
개발자에게
18.9 - 80.1 USD