Author: Provided by sencho, coded by don_forex
Profit factor:
7820.07
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
9 Views
0 Downloads
0 Favorites
Binario_3
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                           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

USD/JPY Jul 2025 - Sep 2025
1.46
Total Trades 54
Won Trades 15
Lost trades 39
Win Rate 27.78 %
Expected payoff 125.81
Gross Profit 21624.43
Gross Loss -14830.76
Total Net Profit 6793.67
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.24
Total Trades 79
Won Trades 8
Lost trades 71
Win Rate 10.13 %
Expected payoff -101.55
Gross Profit 2478.53
Gross Loss -10501.36
Total Net Profit -8022.83
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.55
Total Trades 66
Won Trades 10
Lost trades 56
Win Rate 15.15 %
Expected payoff -64.04
Gross Profit 5216.79
Gross Loss -9443.27
Total Net Profit -4226.48
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.56
Total Trades 48
Won Trades 9
Lost trades 39
Win Rate 18.75 %
Expected payoff -86.98
Gross Profit 5222.30
Gross Loss -9397.20
Total Net Profit -4174.90
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
1.68
Total Trades 44
Won Trades 13
Lost trades 31
Win Rate 29.55 %
Expected payoff 325.39
Gross Profit 35333.50
Gross Loss -21016.30
Total Net Profit 14317.20
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.71
Total Trades 58
Won Trades 11
Lost trades 47
Win Rate 18.97 %
Expected payoff -78.62
Gross Profit 11342.39
Gross Loss -15902.45
Total Net Profit -4560.06
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
156386.06
Total Trades 11
Won Trades 3
Lost trades 8
Win Rate 27.27 %
Expected payoff 32657468.00
Gross Profit 359234434.80
Gross Loss -2297.10
Total Net Profit 359232137.70
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.55
Total Trades 59
Won Trades 12
Lost trades 47
Win Rate 20.34 %
Expected payoff -60.15
Gross Profit 4372.40
Gross Loss -7921.00
Total Net Profit -3548.60
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
1.12
Total Trades 167
Won Trades 47
Lost trades 120
Win Rate 28.14 %
Expected payoff 28.56
Gross Profit 44457.00
Gross Loss -39688.15
Total Net Profit 4768.85
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.70
Total Trades 147
Won Trades 21
Lost trades 126
Win Rate 14.29 %
Expected payoff -56.05
Gross Profit 19435.27
Gross Loss -27674.08
Total Net Profit -8238.81
-100%
-50%
0%
50%
100%

Comments