Trend Trader EA with hedging and price trailing capabilities

MQL5 エキスパート

指定

Particular features:

  1. establish the trend using a nonlagma (below is the mt4 code for this indi, but I want this algorithm to be inserted in the EA, I don't want the EA to call the indicator)angle and price relationship with it (Trend = disabled OR price OR angle OR both; Example: price above MA => uptrend OR MA rises => uptrend OR MA rises and price above it => uptrend) - have this MA drawn on the chart
  2. enter a trade based on the (same algorithm) nonlagma indicator  - have this signal MA drawn on the chart, or some arrow when trade signal occurs
  3. confirm the entry if the price is at a minimum distance away from the latest HH or LL (depending whether the EA buys or - need to set the number of pips from the EA's settings - have the HH or LL (ie swing) drawn on the chart, for example a horizontal line, just like a price level
  4. trail the price using a moving average, ATR, psar, chandelier, pips, fractals (need to be able to select one of this from a drop-down, and have the settings for each to customize) - have the trailing signal drawn on the chart
  5. when the trend changes and there is an opposite trade signal, I want the EA to be able to (if set to do so):
  • close the losing trade and open a new trade according to new signal
  • open a hedging trade and continue hedging if trend reverses back and then again, increasing the lotsize (similar to a martingale, only with the trend) Example: buy 1$ - trend reverses, sel 2$- trend reverses, again buy 4$ etc. Need to have a lfor hedging trades, that will calculate the next lotsize based on all the sells vs all the buys. This means that if the multiplier is 2, then the trades same as the first one (ex buys) are 2 times smaller than the trade same as last one (ex sells). Let me know if it's hard to understand :)
  • do nothing (and wait for the price to hit the SL)

General features (basically everything that others have):

  1. set a fixed lotsize or percentage of free margin
  2. restrict trading by days, hours/market sessions
  3. restrict/stop trading after a given number of trades
  4. close opened trades if a maximum loss occurs
  5. close opened trades if a minimum profit is reached - used when hedging, to allow the EA to close a set of trades that have finally reached a positive profit
  6. set TP, SL and BE
  7. set magic number and comments
  8. martingale - disable/enable and also must have a quotient just like the hedging, so I can choose how much more to risk on the next trade

Other things to consider: I do not care much about time. I also need time to test its functionality, so I'm not in a hurry. I believe that we can wait for each other a little longer, until we are both happy with the result. If the EA will have a small info on the chart, writing about trend, trades, profit etc and other useful info such as max lotsize, broker time, name and so on, it will be even better for my visual.

The nonlagma code used for the trend and signal must have different settings that I can choose from the EA settings. For example Trend nonlagma = 100, signal nonlagma = 10.

For a better understanding of what I need, here's how I imagine the EA's settings:

Trading Sundays = false/true

Trading Mondays = false/true

...

Trading Sessions = true/false (false means ignore the sessions)

Asian session start = 23:00

Asian session finish = 8:00

London session start ...

...

Trend = price / angle / both / disabled

Trend period = 100

Trend price = close/open/etc

Signal = 10

Signal period = 100

Signal price = close/open/etc

Signal shift = 1 (ie bar)

Lotsize management = true/false

Percentage = 0.01 (if above is true)

Fixed = 0.1 (if management = false)

Minimum profit = 1$

Maximum loss = 100$

Maximum trades opened = 4

Stoploss = 30 pips

Take profit = 50 pips

Breakeven = 30 pips

Trailing stop = psar/moving average/chandelier/fractals  (ie candlestick)/atr/pips

Trailing Buffer = 5 pips

Trailing PSAR settings = ...

Trailing MA settings = ...etc

...

Slippage = 3 pips

Magic Number = 333

Trade comment = I am a winner lol

Opposite trade signal = close loser and open new trade accordingly / open hedging trade / do nothing

Hedging Multiplier = 2

Close basket of opposite trades if profit >= Minimum profit (above) = true/false

Close basket of opposite trades if profit <= Maximum loss (above) = true/false

Martingale if last trade closed in negative profit = true/false

Martingale multiplier = 2

Martingale tries = 3 (how many consecutive losses are allowed before we give up and the lotsize resumes to normal)

I hope that I have managed to paint the entire picture. If not, I will try to better explain later.

Below is the mq4 non lag moving average algorithm I want to be used for trend and signal:

#property copyright ""
#property link      ""
#property description ""
#property strict
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Gold
#property indicator_width1 2
#property indicator_color2 Teal
#property indicator_width2 2
#property indicator_color3 Crimson
#property indicator_width3 2
input ENUM_APPLIED_PRICE  Price=0;
extern int     Length         = 15;  //Period of NonLagMA
extern int     Displace       = 0;  //DispLace or Shift 
extern double  PctFilter      = 0;  //Dynamic filter in decimal
extern int     Color          = 1;  //Switch of Color mode (1-color)  
extern int     ColorBarBack   = 1;  //Bar back for color mode
extern double  Deviation      = 0;  //Up/down deviation        
extern int     AlertMode      = 0;  //Sound Alert switch (0-off,1-on) 
extern int     WarningMode    = 0;  //Sound Warning switch(0-off,1-on) 
double MABuffer[];
double UpBuffer[];
double DnBuffer[];
double trend[];
double Del[];
double AvgDel[];
double alfa[];
int i, Phase, Len,Cycle=4;
double Coeff, beta, t, Sum, Weight, g;
double pi = 3.1415926535;    
bool   UpTrendAlert=false, DownTrendAlert=false;
 int OnInit()
  {
   IndicatorBuffers(6);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MABuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,UpBuffer);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,DnBuffer);
   SetIndexBuffer(3,trend);
   SetIndexBuffer(4,Del);
   SetIndexBuffer(5,AvgDel); 
   string short_name;
   IndicatorDigits(int(MarketInfo(Symbol(),MODE_DIGITS)));
   short_name="NonLagMA ("+IntegerToString(Length)+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"Level");
   SetIndexLabel(1,"Up");
   SetIndexLabel(2,"Dn");
   SetIndexShift(0,Displace);
   SetIndexShift(1,Displace);
   SetIndexShift(2,Displace);
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexEmptyValue(1,EMPTY_VALUE);
   SetIndexEmptyValue(2,EMPTY_VALUE);
   SetIndexDrawBegin(0,Length*Cycle+Length+1);
   SetIndexDrawBegin(1,Length*Cycle+Length+1);
   SetIndexDrawBegin(2,Length*Cycle+Length+1);
   Coeff =  3*pi;
   Phase = Length-1;
   Len = Length*4 + Phase;  
   ArrayResize(alfa,Len);
   Weight=0;    
      for (i=0;i<Len-1;i++)
      {
      if (i<=Phase-1) t = 1.0*i/(Phase-1);
      else t = 1.0 + (i-Phase+1)*(2.0*Cycle-1.0)/(Cycle*Length-1.0); 
      beta = MathCos(pi*t);
      g = 1.0/(Coeff*t+1);   
      if (t <= 0.5 ) g = 1;
      alfa[i] = g * beta;
      Weight += alfa[i];
      }
  return(INIT_SUCCEEDED);
  }
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int  shift=0, counted_bars=IndicatorCounted(),limit=0;
   double price=0, Filter=0;      
   if ( counted_bars > 0 )  limit=Bars-counted_bars;
   if ( counted_bars < 0 )  return(0);
   if ( counted_bars ==0 )  limit=Bars-Len-1; 
   if ( counted_bars < 1 ) 
   for(i=1;i<Length*Cycle+Length;i++) 
   {
   MABuffer[Bars-i]=0;    
   UpBuffer[Bars-i]=0;  
   DnBuffer[Bars-i]=0;  
   }
   for(shift=limit;shift>=0;shift--) 
   {    
      Sum = 0;
      for (i=0;i<=Len-1;i++)
           { 
      price = iMA(NULL,0,1,0,3,Price,i+shift);      
      Sum += alfa[i]*price;
      }
        if (Weight > 0) MABuffer[shift] = (1.0+Deviation/100)*Sum/Weight;
      if (PctFilter>0)
      {
      Del[shift] = MathAbs(MABuffer[shift] - MABuffer[shift+1]);
      double sumdel=0;
      for (i=0;i<=Length-1;i++) sumdel = sumdel+Del[shift+i];
      AvgDel[shift] = sumdel/Length;
      double sumpow = 0;
      for (i=0;i<=Length-1;i++) sumpow+=MathPow(Del[shift+i]-AvgDel[shift+i],2);
      double StdDev = MathSqrt(sumpow/Length); 
      Filter = PctFilter * StdDev;
      if(MathAbs(MABuffer[shift]-MABuffer[shift+1]) < Filter) MABuffer[shift]=MABuffer[shift+1];
      }
      else
      Filter=0;
      if (Color>0)
      {
      trend[shift]=trend[shift+1];
      if (MABuffer[shift]-MABuffer[shift+1] > Filter) trend[shift]= 1; 
      if (MABuffer[shift+1]-MABuffer[shift] > Filter) trend[shift]=-1; 
         if (trend[shift]>0)
         {  
         UpBuffer[shift] = MABuffer[shift];
         if (trend[shift+ColorBarBack]<0) UpBuffer[shift+ColorBarBack]=MABuffer[shift+ColorBarBack];
         DnBuffer[shift] = EMPTY_VALUE;
         if (WarningMode>0 && trend[shift+1]<0 && shift==0) PlaySound("alert2.wav");
         }
         if (trend[shift]<0) 
         {
         DnBuffer[shift] = MABuffer[shift];
         if (trend[shift+ColorBarBack]>0) DnBuffer[shift+ColorBarBack]=MABuffer[shift+ColorBarBack];
         UpBuffer[shift] = EMPTY_VALUE;
         if (WarningMode>0 && trend[shift+1]>0 && shift==0) PlaySound("alert2.wav");
         }
      }
   }   
   string Message;
   if (trend[2]<0 && trend[1]>0 && Volume[0]>1 && !UpTrendAlert)
        {
        Message = " NonLagMA "+Symbol()+" M"+IntegerToString(Period())+": changed to uptrend";
        if ( AlertMode>0 ) Alert (Message); 
        UpTrendAlert=true; DownTrendAlert=false;
        } 
        if ( trend[2]>0 && trend[1]<0 && Volume[0]>1 && !DownTrendAlert)
        {
        Message = " NonLagMA "+Symbol()+" M"+IntegerToString(Period())+": changed to downtrend";
        if ( AlertMode>0 ) Alert (Message); 
        DownTrendAlert=true; UpTrendAlert=false;
        }                
        return(rates_total);
}















応答済み

1
開発者 1
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
2
開発者 2
評価
(42)
プロジェクト
70
43%
仲裁
6
33% / 50%
期限切れ
19
27%
類似した注文
Specific time EA 50 - 100 USD
EA must be able to enter Buy or Sell or Both trade(s) as a market order at a pre-determined time specified as HH:mm:ss using one of two options: regardless of what the price of the instrument is at that time or using the price as at the last closed minute as the reference eg, if specified time is 09:29:20 (HH:mm:ss), then the last reference price should be 09:29:00 If this option (1.b. / reference price) is selected
looking for a developer who can Design MT5 EA as per my Strategy based on Nadaraya [LuxAlgo] + RSI Multi Length [LuxAlgo] pine script indicator to MT5 (Mql5) Main Inputs 01) Indicator: Nadaraya [LuxAlgo] + RSI Multi Length [LuxAlgo] 02) CYCLE SETTINGS 03) LOT SIZE SETTINGS 04) TP, SL, TS SETTINGS 05) EQUITY PROTECTOR SETTINGS 06) CUSTOM TRADING SESSION TIMES 07) HIGH IMPACT NEWS FILTER Stratagy is : After identify
If auto trading disabled and trades closed (like to avoid news), then when auto trading enabled, EA needs to start trading again right away, but it doesn't. If the terminal is restarted with active EA, the EA should pick up where it left off, not make new trades because terminal restart. EA has terminal GVs. If EA is re initialized with same set file it overwrites the GVs, it should not overwrite the GV values, but
I need assistance setting up both manual and automated trading strategies. I want the flexibility to add multiple strategies in the same order as needed. Additionally, I need any profits made to automatically convert to USDT (Tether) rather than remaining in the same coin. The setup should be compatible for both PC and mobile use, and across platforms including Binance, Bybit, Bitget, Gate.io, and TradingView. If you
I need a developer who can convert my simple script from tradestation to pinescript about just 15 to 20 lines of code, the code will be drop in the conversation please let me know if this is what you can do
I want to convert my tradingview indicator to MT4. I need a developer who can get it completed under the course of 24-48hrs. And I need some who is more experience at this level and possibly if you have experience with NinjaTrader too, we can collaborate and work on it as well
Hello, I would like you to help me develop a simple Expert Advisor (EA) for trading the Boom and Crash markets. All the project requirements is available with me . kindly bid if you can develop EA for boom and out crash . Thanks
Hello, I am looking for an programmer to convert a TradingView strategy pine script to MT5 EA auto trade bot. The indicator is based on the FVG/Imbalance (Pine script will be provided) The MT5 EA must return 100% the same results as TradingView script The MT5 EA must include the same options as TradingView The MT5 EA must be errors free
Project Overview: We are seeking an experienced developer to create a custom Copy Trading Expert Advisor (EA) that supports two-way communication between MetaTrader 4 (MT4), MetaTrader 5 (MT5), and cTrader trading terminals. The EA should enable seamless copying of trades from one account to another, incorporating additional settings for flexibility and customization. The project will involve developing a DLL
I am currently seeking the expertise of a skilled MQL5 developer to assist with a custom trading bot project tailored to specific requirements. The project entails the development of a versatile trading bot capable of implementing both manual and automated strategies, with flexibility to switch between strategies seamlessly. Additionally, the bot should be designed to convert profits automatically into USDT, allowing

プロジェクト情報

予算
50+ USD
開発者用
45 USD
締め切り
最高 30 日