TOROS EA

MQL4 Experts

Trabalho concluído

Tempo de execução 2 dias
Comentário do desenvolvedor
very good client,pleasure to work with

Termos de Referência

#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;
            }
         
         } 
      
      }
   
   } 
   
   
   
   
   
   
   
   
   
   
   
   



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

Respondido

1
Desenvolvedor 1
Classificação
(103)
Projetos
130
44%
Arbitragem
7
43% / 43%
Expirado
7
5%
Livre
2
Desenvolvedor 2
Classificação
(2)
Projetos
2
0%
Arbitragem
0
Expirado
0
Livre
Pedidos semelhantes
Creating of an expert advisor or trading bot that uses a Top Down analysis (using monthly, weekly, daily, hourly, minutes ( 30, 15, 5, 1) to determine trade direction or trend direction and makes multiple trade decisions for mt4. You can use or combine accurate trend indicators
Creating of an expert advisor or trading bot that uses a Top Down analysis (using monthly, weekly, daily, hourly, minutes ( 30, 15, 5, 1) to determine trade direction or trend direction and makes multiple trade decisions for mt4. You can use or combine accurate trend indicators
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA
I am looking forward to automate my trading strategy where I use renko bars on Tradingview. I really want to use unirenkos too, but unfortunately I couldn't figure out how to use ninjatrader on my MacBook and Tradingview does not offer unirenkos. As far as I see from your offered services you are very familiar with ninjatrader. I wanted to ask you if you could code me an Indicator for unirenkos for Tradingview so I
I am looking forward to automate my trading strategy where I use renko bars on Tradingview. I really want to use unirenkos too, but unfortunately I couldn't figure out how to use ninjatrader on my MacBook and Tradingview does not offer unirenkos. As far as I see from your offered services you are very familiar with ninjatrader. I wanted to ask you if you could code me an Indicator for unirenkos for Tradingview so I
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA
Hello, I want to create an EA that can be able to take and optimise trade bids using the trend tracker concept I have developed. The tracker will monitor 2 lines to determine the trend of the market and afterwards take bids towards the correct direction. It will also be able to use a distance between the bids for the direction of the trend and plan a reverse bid when the price of the extreme doesn’t change again. The
Gradient boosting and L2 100 - 200 USD
I am looking for a well experienced programmer to put/implement a gradient boosting algorithm and an L2 to reduce overfitting in my ea which l already have which uses indicators . If you are experienced please adhere
Hello, I'm looking for a developer for repair calendar in EA MT4/MT5 (News Filter - https://ec.forexprostools.com ) for all windows servers. Note: EA MT4/MT5 works with calendar on PC Win 10, 11 but not on all windows servers. I have the source code and will post within the comments section for review. If you are able to do this and quality. Please apply. Thanks
Create mt4 ea 50+ USD
To convert the provided MT4 indicator script into an Expert Advisor (EA) and implement prompt functionality for user input, we need to modify the code to handle external parameters and provide a user-friendly interface. Below is the EA code that incorporates prompts for user inputs

Informações sobre o projeto

Orçamento
30+ USD
Desenvolvedor
27 USD