Firebird_v1

Author: TraderSeven
Profit factor:
0.36
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt can change open orders parameters, due to possible stepping strategy
0 Views
0 Downloads
0 Favorites
Firebird_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                    MA envelope exhausting system |
//+------------------------------------------------------------------+
#property copyright "TraderSeven"
//----------------------- USER INPUT
extern double MA_length = 10;	 
extern double slip = 0;
extern double Lots = 1;
extern double TakeProfit = 30;
extern double Stoploss = 2000;
//extern double TrailingStop = 5;
extern double PipStep = 30;
   //----------------------- SETUP VARS
double PriceTarget;
double AveragePrice;
double LastPrice;
int flag;
//----------------------- MAIN PROGRAM LOOP
int start()
{
   int cnt=0, total;
   double Stopper=0;  
   total=OrdersTotal();
   OrderSelect(total, SELECT_BY_POS, MODE_TRADES);
   LastPrice=OrderOpenPrice();
   OrderSelect(total, SELECT_BY_POS, MODE_TRADES); 
   flag=0;
   if(iMA(NULL,0,MA_length,0,MODE_SMA,PRICE_OPEN,0)*1.02<Bid && (Bid>=(LastPrice+(PipStep*Point)))||(total<1)) // Go SHORT -> Only sell if >= 30 pips above previous position entry	 
     {
      OrderSend(Symbol(),OP_SELL,Lots,Bid,slip,Bid+(Stoploss*Point),Bid-(TakeProfit*Point),0,0,HotPink);
      if(total>0)flag=1;
     }   
   if(iMA(NULL,0,MA_length,0,MODE_SMA,PRICE_OPEN,0)*0.98>Ask && (Ask<=(LastPrice-(PipStep*Point)))||total<1) // Go LONG -> Only buy if >= 30 pips below previous position entry	 
     {
      OrderSend(Symbol(),OP_BUY,Lots,Ask,slip,Ask-(Stoploss*Point),Ask+(TakeProfit*Point),0,0,Lime);
      if(total>0)flag=1;
     }
//----------------------- CALCULATE AVERAGE OPENING PRICE
   total=OrdersTotal();
   AveragePrice=0;
   for(cnt=0;cnt<total;cnt++)
      {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      AveragePrice=AveragePrice+OrderOpenPrice();
      }
   AveragePrice=AveragePrice/total;
//----------------------- RECALCULATE STOPLOSS & PROFIT TARGET BASED ON AVERAGE OPENING PRICE
  OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
  if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())  
    {
    flag=1;
    if(OrderType()==OP_BUY) // Calculate profit/stop target for long 
      {
      PriceTarget=AveragePrice+(TakeProfit*Point);
      Stopper=AveragePrice-(Stoploss*Point); 
      }
     else // Calculate profit/stop target for short
      {
      PriceTarget=AveragePrice-(TakeProfit*Point);
      Stopper=AveragePrice+(Stoploss*Point);   
      }
    }
//----------------------- IF NEEDED CHANGE ALL OPEN ORDERS TO NEWLY CALCULATED PROFIT TARGET    
  if(flag==1)// check if average has really changed
    {   
    for(cnt=0;cnt<total;cnt++)
       {
       PriceTarget=total;
       OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);            
       OrderModify(OrderTicket(),0,Stopper,PriceTarget,0,Yellow);// set all positions to averaged levels
       }
    }
}

Profitability Reports

USD/CAD Oct 2024 - Jan 2025
0.47
Total Trades 140
Won Trades 135
Lost trades 5
Win Rate 96.43 %
Expected payoff -23.44
Gross Profit 2893.07
Gross Loss -6175.34
Total Net Profit -3282.27
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.37
Total Trades 80
Won Trades 76
Lost trades 4
Win Rate 95.00 %
Expected payoff -47.53
Gross Profit 2280.00
Gross Loss -6082.00
Total Net Profit -3802.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.47
Total Trades 198
Won Trades 191
Lost trades 7
Win Rate 96.46 %
Expected payoff -32.19
Gross Profit 5730.00
Gross Loss -12104.00
Total Net Profit -6374.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.14
Total Trades 36
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -168.89
Gross Profit 960.00
Gross Loss -7040.00
Total Net Profit -6080.00
-100%
-50%
0%
50%
100%

Comments