Binario_3_v1

Author: Provided by sencho, coded by don_forex
Profit factor:
0.77
Price Data Components
Series array that contains close prices for each bar
Orders Execution
Checks for the total of open ordersIt can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reached
Indicators Used
Moving average indicator
3 Views
0 Downloads
0 Favorites
Binario_3_v1
//+------------------------------------------------------------------+
//|                           Copyright 2005, Gordago Software Corp. |
//|                                          http://www.gordago.com/ |
//+------------------------------------------------------------------+
// I want to thank Michal Rutka, michal1@zonnet.nl, for helping me correct
// the mistakes that I made... Good Job!!
#property copyright "Provided by sencho, coded by don_forex"
#property link      "http://www.gordago.com"
//----
extern int TakeProfit=850;
extern int TrailingStop=850;
extern int PipDifference=25;
extern double Lots=0.1;
extern double MaximumRisk=10;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
  int start()
  {
   int cnt, ticket;
     if(Bars<100)
     {
      Print("bars less than 100");
      return(0);
     }
     if(TakeProfit<10)
     {
      Print("TakeProfit less than 10");
      return(0);
     }
   string TradeSymbol=Symbol();
   double MA144H=MathRound(iMA(NULL,0,144,0,MODE_EMA,PRICE_HIGH,0)/Point)*Point;
   double MA144L=MathRound(iMA(NULL,0,144,0,MODE_EMA,PRICE_LOW,0)/Point)*Point;
   double Spread=Ask-Bid; // MarketInfo(TradeSymbol,MODE_SPREAD);
   double BuyPrice     =MA144H + Spread+PipDifference*Point;
   double BuyStopLoss  =MA144L - Point;
   double BuyTakeProfit=MA144H +(PipDifference+TakeProfit)*Point;
   double SellPrice    =MA144L -(PipDifference)*Point;
   double SellStopLoss =MA144H + Spread+Point;
   double SellTakeProfit= MA144L - Spread-(PipDifference+TakeProfit)*Point;
   double lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/50000,1);
   double close=iClose(NULL,0,0);
   int total=OrdersTotal();
//----
   bool need_long =true;
   bool need_short=true;
   // First update existing orders.
     for(cnt=0;cnt<total;cnt++) 
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
        if(OrderSymbol()==Symbol() && OrderMagicNumber()==16384)
        {
           if(OrderType()==OP_BUYSTOP)
           {
            need_long=false;
              if (OrderStopLoss()!=BuyStopLoss)
              {
               Print(BuyStopLoss, " ",OrderStopLoss());
               OrderModify(OrderTicket(),BuyPrice,BuyStopLoss,BuyTakeProfit,0,Green);
              }
           }
           if(OrderType()==OP_SELLSTOP)
           {
            need_short=false;
              if (OrderStopLoss()!=SellStopLoss)
              {
               Print(SellStopLoss, " ",OrderStopLoss());
               OrderModify(OrderTicket(),SellPrice,SellStopLoss,SellTakeProfit,0,Green);
              }
           }
           if(OrderType()==OP_BUY)
           {
            need_long=false;
              if (OrderStopLoss()<BuyStopLoss)
              {
               Print(BuyStopLoss, " ",OrderStopLoss());
               OrderModify(OrderTicket(),OrderOpenPrice(),BuyStopLoss,BuyTakeProfit,0,Green);
               OrderDelete(OrderTicket());
              }
              if(TrailingStop>0) 
              {
                 if(Bid-OrderOpenPrice()>Point*TrailingStop) 
                 {
                    if(OrderStopLoss()<Bid-Point*TrailingStop) 
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
                     return(0);
                    }
                 }
              }
           }
           if(OrderType()==OP_SELL)
           {
            need_short=false;
              if (OrderStopLoss()>SellStopLoss)
              {
               Print(SellStopLoss, " ",OrderStopLoss());
               OrderModify(OrderTicket(),OrderOpenPrice(),SellStopLoss,SellTakeProfit,0,Green);
               OrderDelete(OrderTicket());
              }
              if(TrailingStop>0) 
              {
                 if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) 
                 {
                    if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0)) 
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
                     return(0);
                    }
                 }
              }
           }
        }
     }
     if(AccountFreeMargin()<(1000*lot))
     {
      Print("We have no money. Free Margin = ", AccountFreeMargin());
      return(0);
     }
     if (close<MA144H && close>MA144L)
     {
      if(need_long)
         ticket=OrderSend(Symbol(),OP_BUYSTOP,lot,BuyPrice,3,BuyStopLoss,BuyTakeProfit,"Binario_v3",16384,0,Green);
      if(need_short)
         ticket=OrderSend(Symbol(),OP_SELLSTOP,lot,SellPrice,3,SellStopLoss,SellTakeProfit,"Binario_v3",16384,0,Red);
     }
  }
//+------------------------------------------------------------------+

Profitability Reports

EUR/USD Jan 2025 - Jul 2025
0.73
Total Trades 157
Won Trades 25
Lost trades 132
Win Rate 15.92 %
Expected payoff -52.03
Gross Profit 21923.90
Gross Loss -30092.80
Total Net Profit -8168.90
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.58
Total Trades 143
Won Trades 21
Lost trades 122
Win Rate 14.69 %
Expected payoff -52.89
Gross Profit 10661.30
Gross Loss -18225.20
Total Net Profit -7563.90
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
1.11
Total Trades 51
Won Trades 9
Lost trades 42
Win Rate 17.65 %
Expected payoff 21.60
Gross Profit 11279.37
Gross Loss -10177.83
Total Net Profit 1101.54
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.76
Total Trades 43
Won Trades 6
Lost trades 37
Win Rate 13.95 %
Expected payoff -50.36
Gross Profit 7002.50
Gross Loss -9167.90
Total Net Profit -2165.40
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.68
Total Trades 90
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -61.91
Gross Profit 11729.00
Gross Loss -17301.00
Total Net Profit -5572.00
-100%
-50%
0%
50%
100%

Comments