TOROS EA

MQL4 专家

工作已完成

执行时间2 天
员工反馈
very good client,pleasure to work with

指定

#include <Trade\Trade.mqh> // Get code from other places

//--- Input Variables (Accessible from MetaTrader 5)

input double   lot = 0.01;
input int      slippage = 3;
input bool     useStopLoss = true;
input double   stopLossPips = 100;
input bool     useTakeProfit = true;
input double   takeProfitPips = 300;
input int      MAperiodShort=5;
input int      DonchianPeriod=100;   
input int      InverseFisherPeriodsshort=40;
input bool     useTrailingStop=true;                                   
input double   trailingStopPips=40;


//--- Service Variables (Only accessible from the MetaEditor)

CTrade myTradingControlPanel;

double  MaDataShort[];
int     MaControlPanelShort;
double  numberofMaDataShort;
double  MaDataShort1,MaDataShort2,MaDataShort3;

double DonchianDataHigh[],DonchianDataLow[];
int   DonchianControlPanel;
double numberofDonchianDataHigh,numberofDonchianDataLow;
double DonchianDataHigh1,DonchianDataHigh2,DonchianDataHigh3;
double DonchianDataLow1,DonchianDataLow2,DonchianDataLow3;

int P;
double currentBid, currentAsk;
double stopLossPipsFinal, takeProfitPipsFinal, stopLevelPips;
double stopLossLevel, takeProfitLevel;

int    inverseFisherTransformPanelshort;
string ehlers_inverse_fisher_transform_2short;
double inverseFisherDatashort1[],inverseFisherDatashort2[];
double   eInverseFisherDataNormalizeshort1, eInverseFisherDataNormalizeshort2;
int  numberofInverseFisherDatashort1,numberofInverseFisherDatashort2;

double DS;


double newStopLossPips; 
double newTrailingStopPrice;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
 
  
   ArraySetAsSeries(MaDataShort,true);
   MaControlPanelShort =iMA(_Symbol,_Period,MAperiodShort,0,MODE_SMA,PRICE_CLOSE);
    
  
   ArraySetAsSeries(inverseFisherDatashort1,true);  
   ArraySetAsSeries(inverseFisherDatashort2,true);  
   inverseFisherTransformPanelshort = iCustom(_Symbol,_Period,"ehlers_inverse_fisher_transform_2",InverseFisherPeriodsshort);
   
   ArraySetAsSeries(DonchianDataHigh,true);
    ArraySetAsSeries(DonchianDataLow,true);
   DonchianControlPanel=iCustom(_Symbol,_Period,"donchian_channel",DonchianPeriod);
   
   
   
   
   if(_Digits == 5 || _Digits == 3 || _Digits == 1) P = 10;else P = 1; // To account for 5 digit brokers
   
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
   IndicatorRelease(MaControlPanelShort);
   IndicatorRelease(DonchianControlPanel);
   IndicatorRelease(inverseFisherTransformPanelshort);
   
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   // -------------------- Collect most current data --------------------
   
   currentBid = SymbolInfoDouble(_Symbol,SYMBOL_BID); // Get latest Bid Price
   currentAsk = SymbolInfoDouble(_Symbol,SYMBOL_ASK); // Get latest Ask Price
   
  
   
   numberofMaDataShort=CopyBuffer(MaControlPanelShort,0,0,5,MaDataShort);
   
   MaDataShort1=MaDataShort[1];
   MaDataShort2=MaDataShort[2];
   MaDataShort3=MaDataShort[3];
   
   numberofDonchianDataHigh=CopyBuffer(DonchianControlPanel,0,0,5,DonchianDataHigh);
   numberofDonchianDataLow=CopyBuffer(DonchianControlPanel,1,0,5,DonchianDataLow);
   DonchianDataHigh1=DonchianDataHigh[1];
   DonchianDataHigh2=DonchianDataHigh[2];
   DonchianDataHigh3=DonchianDataHigh[3];
   
   DonchianDataLow1=DonchianDataLow[1];
   DonchianDataLow2=DonchianDataLow[2];
   DonchianDataLow3=DonchianDataLow[3];
   
   
   numberofInverseFisherDatashort1 =CopyBuffer(inverseFisherTransformPanelshort,0,0,3,inverseFisherDatashort1);
   numberofInverseFisherDatashort2 = CopyBuffer(inverseFisherTransformPanelshort,0,0,3,inverseFisherDatashort2);
   
   
   eInverseFisherDataNormalizeshort1=NormalizeDouble(inverseFisherDatashort1[1],3);
   eInverseFisherDataNormalizeshort2=NormalizeDouble(inverseFisherDatashort2[2],3);
  
  DS=DonchianDataHigh1/DonchianDataLow1;
  
  
   // -------------------- Technical Requirements --------------------
   
   // Explanation: Stop Loss and Take Profit levels can't be too close to our order execution price. We will talk about this again in a later lecture.
   // Resources for learning more: https://book.mql4.com/trading/orders (ctrl-f search "stoplevel"); https://book.mql4.com/appendix/limits
   
   stopLevelPips = (double) (SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL) + SymbolInfoInteger(_Symbol, SYMBOL_SPREAD)) / P; // Defining minimum StopLevel

   if (stopLossPips < stopLevelPips) 
      {
      stopLossPipsFinal = stopLevelPips;
      } 
   else
      {
      stopLossPipsFinal = stopLossPips;
      } 
      
   if (takeProfitPips < stopLevelPips) 
      {
      takeProfitPipsFinal = stopLevelPips;
      }
   else
      {
      takeProfitPipsFinal = takeProfitPips;
      }
      
  // -------------------- EXITS --------------------
   
   if(PositionSelect(_Symbol) == true) // We have an open position
      { 
      
      // --- Exit Rules (Long Trades) ---
      
      /*
      Exits:
      - Exit the long trade when SMA(10) crosses SMA(40) from top
      - Exit the short trade when SMA(10) crosses SMA(40) from bottom
      */
      
      // TDL 3: Enter exit rule for long trades
      
        if (DonchianDataLow1<DonchianDataLow2&&
         eInverseFisherDataNormalizeshort1<eInverseFisherDataNormalizeshort2)
         {
         if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) // If it is Buy position
            { 
            
            myTradingControlPanel.PositionClose(_Symbol); // Closes position related to this symbol
            
            if(myTradingControlPanel.ResultRetcode()==10008 || myTradingControlPanel.ResultRetcode()==10009) //Request is completed or order placed
               {
               Print("Exit rules: A close order has been successfully placed with Ticket#: ",myTradingControlPanel.ResultOrder());
               }
            else
               {
               Print("Exit rules: The close order request could not be completed.Error: ",GetLastError());
               ResetLastError();
               return;
               }
               
            }
         }
      
      // TDL 4: Enter exit rule for short trades
      
      // --------------------------------------------------------- //
      // --------------------------------------------------------- //  
      if  (DonchianDataHigh1>DonchianDataHigh2&&
      eInverseFisherDataNormalizeshort1>eInverseFisherDataNormalizeshort2)
       
         if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL) // If it is Sell position
            { 
            
            myTradingControlPanel.PositionClose(_Symbol); // Closes position related to this symbol
            
            if(myTradingControlPanel.ResultRetcode()==10008 || myTradingControlPanel.ResultRetcode()==10009) //Request is completed or order placed
               {
               Print("Exit rules: A close order has been successfully placed with Ticket#: ", myTradingControlPanel.ResultOrder());
               }
            else
               {
               Print("Exit rules: The close order request could not be completed. Error: ", GetLastError());
               ResetLastError();
               return;
               }
            }
         }
      
       if(useTrailingStop==true)
        {
         if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY)
           {
            newTrailingStopPrice = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_BID) - trailingStopPips*(_Point*P), _Digits);
            if(newTrailingStopPrice > PositionGetDouble(POSITION_PRICE_OPEN))
              { //if price has moved in favour of trade by more than trailingStopPips
               if(newTrailingStopPrice > PositionGetDouble(POSITION_SL))
                 { //if existing SL is not as tight as newTrailingStopPrice
                  myTradingControlPanel.PositionModify(_Symbol, newTrailingStopPrice, PositionGetDouble(POSITION_TP));
                  Print("Trailing Stop has moved to ", newTrailingStopPrice);
                 }
              }
           }
         if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL)
           {
            newTrailingStopPrice = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK) + trailingStopPips*(_Point*P), _Digits);
            if(newTrailingStopPrice < PositionGetDouble(POSITION_PRICE_OPEN))
              { //if price has moved in favour of trade by more than trailingStopPips
               if(newTrailingStopPrice < PositionGetDouble(POSITION_SL) || PositionGetDouble(POSITION_SL) == 0)
                 { //if existing SL is not as tight as newTrailingStopPrice
                  myTradingControlPanel.PositionModify(_Symbol, newTrailingStopPrice, PositionGetDouble(POSITION_TP));
                  Print("Trailing Stop has moved to ", newTrailingStopPrice);
                 }
              }
           }
        }
      
   
   // -------------------- ENTRIES --------------------  
         
   if(PositionSelect(_Symbol) == false) // We have no open position
      { 
      
      // --- Entry Rules (Long Trades) ---
      
      /*
      Entries:
      - Enter a long trade when SMA(10) crosses SMA(40) from bottom
      - Enter a short trade when SMA(10) crosses SMA(40) from top
      */
      
      // TDL 1: Enter entry rule for long trades
      
      // --------------------------------------------------------- //
      
        if  (DonchianDataHigh1>DonchianDataHigh2&&MaDataShort1>MaDataShort2
        &&DonchianDataLow1>=DonchianDataLow2&&eInverseFisherDataNormalizeshort1>eInverseFisherDataNormalizeshort2&&DS>1.0097)
       // &&eInverseFisherDataNormalizeshort1>eInverseFisherDataNormalizeshort2&&
        //eInverseFisherDataNormalizeshort1>0&&eInverseFisherDataNormalizeshort2>0)
         
      
         {   
         
         if (useStopLoss) stopLossLevel = currentAsk - stopLossPipsFinal * _Point * P; else stopLossLevel = 0.0;
         if (useTakeProfit) takeProfitLevel = currentAsk + takeProfitPipsFinal * _Point * P; else takeProfitLevel = 0.0;
        
         myTradingControlPanel.PositionOpen(_Symbol, ORDER_TYPE_BUY, lot, currentAsk, stopLossLevel, takeProfitLevel, "Buy Trade. Magic Number #" + (string) myTradingControlPanel.RequestMagic()); // Open a Buy position
         
         if(myTradingControlPanel.ResultRetcode()==10008 || myTradingControlPanel.ResultRetcode()==10009) //Request is completed or order placed
            {
            Print("Entry rules: A Buy order has been successfully placed with Ticket#: ", myTradingControlPanel.ResultOrder());
            }
         else
            {
            Print("Entry rules: The Buy order request could not be completed. Error: ", GetLastError());
            ResetLastError();
            return;
            }
           
         }
         
      // --- Entry Rules (Short Trades) ---
      
      /*
      Exit:
      - Exit the long trade when SMA(10) crosses SMA(40) from top
      - Exit the short trade when SMA(10) crosses SMA(40) from bottom
      */
      
      // TDL 2: Enter entry rule for short trades
      
      // --------------------------------------------------------- //
      
      else if  (DonchianDataLow1<DonchianDataLow2&&MaDataShort1<MaDataShort2
      &&DonchianDataHigh1<=DonchianDataHigh2&&eInverseFisherDataNormalizeshort1<eInverseFisherDataNormalizeshort2&&DS>1.0097)
     // &&eInverseFisherDataNormalizeshort1<eInverseFisherDataNormalizeshort2&&
       //       eInverseFisherDataNormalizeshort1<0&&eInverseFisherDataNormalizeshort2<0)
               
     
      
         {   
         
         if (useStopLoss) stopLossLevel = currentBid + stopLossPipsFinal * _Point * P; else stopLossLevel = 0.0;
         if (useTakeProfit) takeProfitLevel = currentBid - takeProfitPipsFinal * _Point * P; else takeProfitLevel = 0.0;

         myTradingControlPanel.PositionOpen(_Symbol, ORDER_TYPE_SELL, lot, currentBid, stopLossLevel, takeProfitLevel, "Sell Trade. Magic Number #" + (string) myTradingControlPanel.RequestMagic()); // Open a Sell position
         
         if(myTradingControlPanel.ResultRetcode()==10008 || myTradingControlPanel.ResultRetcode()==10009) //Request is completed or order placed
            {
            Print("Entry rules: A Sell order has been successfully placed with Ticket#: ", myTradingControlPanel.ResultOrder());
            }
         else
            {
            Print("Entry rules: The Sell order request could not be completed.Error: ", GetLastError());
            ResetLastError();
            return;
            }
         
         } 
      
      }
   
   } 
   
   
   
   
   
   
   
   
   
   
   
   



//+------------------------------------------------------------------+

反馈

1
开发者 1
等级
(111)
项目
139
43%
仲裁
9
33% / 44%
逾期
6
4%
空闲
2
开发者 2
等级
(4)
项目
4
0%
仲裁
1
0% / 0%
逾期
0
空闲
相似订单
Experienced Trading Software Developer Needed – Multi-Platform Development Hello! I'm looking for an experienced developer to create a custom trading indicator and convert it into an automated trading bot for the following platforms: MT5 NinjaTrader 8 Quantower cTrader The plan is to develop the same indicator and trading bot for all four platforms, one after another. Project requirements: Custom trading indicator
un écosystème logiciel asynchrone multi-comptes dopé par un module de supervision par Intelligence Artificielle (Guardian AI). La solution assure le pilotage automatisé, le filtrage de marché en temps réel et le contrôle des risques pour 20+ comptes MetaTrader 4/5 (via MetaApi) et Deriv sur VPS Equinix NY4. vous aurez plus de detail dans les échanges
Order flow 30+ USD
Hi! I need an experience developer with order flow, volume delta, and futures scalping, and I wanted to ask you a few questions. Have you personally developed and tested fast-paced strategies for Gold Futures (GC), particularly those that enter during short-term price impulses and scale into positions as momentum builds? From your experience, what indicators or signals help you determine whether an impulse has enough
I am looking for an experienced MQL5 developer for the first milestone of a larger MetaTrader 5 project: a multi-symbol, multi-timeframe signal scanner with alerts. This milestone covers indicator integration only. There is no order placement or trade management at any stage. Scope of this milestone Read outputs from three custom indicators (provided as compiled files after selection and NDA) reliably via iCustom and
RA_BOT 2.0 36+ USD
//@version=4 study(title="UT Bot Alerts", overlay = true) // Inputs a = input(1, title = "Key Vaule. 'This changes the sensitivity'") c = input(10, title = "ATR Period") h = input(false, title = "Signals from Heikin Ashi Candles") xATR = atr(c) nLoss = a * xATR src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close xATRTrailingStop = 0.0 xATRTrailingStop := iff(src >
Andrew 50 - 200 USD
Hello, I am from Tanzania. I am looking for a professional MQL5 programmer from Tanzania who can help me develop and improve my automated MT5 trading robot. The project is called SMC XAVAGE AI, and it trades XAUUSD (Gold). I would like to discuss the project with you. Are you based in Tanzania? Would it be possible to arrange a meeting or a call? Thank you
Metafix 50 - 200 USD
Here is a professional specification you can send directly to your developer. # Project Requirements Specification: MetaTrader 5 Trading Robot Development ### 1. Project Overview I want to develop an automated Forex trading robot (Expert Advisor) for MetaTrader 5 (MT5). The robot should analyse the financial markets, identify trading opportunities, and execute trades automatically based on predefined strategies. ###
1. Platform: MT4 The EA required is not linked, neither depending on trading strategy nor trading signals nor indicators. 2. Initial order is a pending order (buy stop/ sell stop) and it is created manually. It is open for a specified symbol (pair) at a specified price with a specified S/L 3. Example: buy stop 0.1 lot GBPUSD @ 1.3085 WITH S/L @1.3075 Once target price is reached, pending order will
I am looking for an experienced trading software developer interested in building a long-term working relationship. Im a professional Trader, Coach and Mentor, I work with traders and Student who require customized trading solutions, including automated trading bots, Expert Advisors, custom indicators, trading strategies and other algorithmic trading tools. I am looking for a technically skilled developer who can
Salman serhal 30 - 100 USD
MT5 ICT XAUUSD Sell-Only Trading Robot with Fibonacci Confirmation I am looking for an experienced MQL5 developer to create a custom Expert Advisor (EA) for MetaTrader 5, specifically for trading Gold (XAUUSD). 1. Trading Strategy The robot must use the ICT trading methodology and focus on SELL trades only. The strategy should include: * Identify important resistance and premium zones. * Use Fibonacci retracement

项目信息

预算
30+ USD