BrijonRocks_FF

Orders Execution
It automatically opens orders when conditions are reached
Indicators Used
Moving average indicator
0 Views
0 Downloads
0 Favorites

Profitability Reports

GBP/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 15
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -362.53
Gross Profit 25.60
Gross Loss -5463.50
Total Net Profit -5437.90
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 14
Won Trades 0
Lost trades 14
Win Rate 0.00 %
Expected payoff -629.22
Gross Profit 0.00
Gross Loss -8809.10
Total Net Profit -8809.10
-100%
-50%
0%
50%
100%
BrijonRocks_FF
//+------------------------------------------------------------------+
//|                          BrijonSingleTester.mq4       
//+------------------------------------------------------------------+
extern int       TP=15;
extern double    MarginRatio=0.025;                
extern double    PositionSize=0.1;
extern int       MagicNObase = 10000;             // this is a stupid part that has to be manually set when attaching EA to a chart.
extern int       DDistCriteria = 100;             // determine if the Dist is profittable and safe w/o drawdown.
extern int       HDistCriteria = 15;              // determine if the Dist is profittable and safe w/o drawdown.
extern int       breath = 2;
extern int       SessionStart = 21;
extern int       SessionEnd = 6;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  { return(0); }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  { return(0); }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{  
   double PendingCap, DWL, HWL;    
   int DDist, HDist; 
       
	  PendingCap = Risk();                                                                     
	  if (PendingCap <= MarginRatio && ( Hour()>=SessionStart || Hour()<=SessionEnd )  )            // 1. Verify sizing; 2. trade only in Asian Morning.
     {  Print("Current Positions take ", PendingCap, " capital; OK to Trade!");  
     
        DWL = WLcollector(1440);                     // 1440 minute = 1 day
        HWL = WLcollector(60);                       // 60 minute = 1 hour       
        if (Ask < DWL)
           {
           DDist = (-Ask+DWL)/Point;
           HDist = (-Ask+HWL)/Point;
           }
        else if (Bid > DWL)   
           {
           DDist = (-DWL+Bid)/Point;
           HDist = (-HWL+Bid)/Point;        
           }     
        if (DDist>DDistCriteria&&HDist>HDistCriteria )
        {
           placetrades(DWL);
        }
     }        // PendingCap if, highest if
   return(0);  
} 
// End of 'Start' section
//+------------------------------------------------------------------+
double Risk()                                      //output the ratio of position/capital
{
      double riskratio;      
      riskratio = AccountMargin()/AccountFreeMargin();
      return(riskratio);     
}
//+------------------------------------------------------------------+
double WLcollector(int MAtimeframe)
{     
      double ma5=iMA(NULL,MAtimeframe,5,0,MODE_SMA,PRICE_CLOSE,0);
      double ma7=iMA(NULL,MAtimeframe,7,0,MODE_SMA,PRICE_CLOSE,0);
      double ma22=iMA(NULL,MAtimeframe,22,0,MODE_SMA,PRICE_CLOSE,0);

      double WLoutput = (ma5+ma7+ma22)/3;

      if (Symbol()=="GBPUSD")
         {
         double ma34=iMA(NULL,MAtimeframe,34,0,MODE_SMA,PRICE_CLOSE,0);
         WLoutput = (ma5+ma7+ma22+ma34)/4;
         }
      return(WLoutput);
}
//+------------------------------------------------------------------+
void placetrades(double DailyWL)
{   
   int ticket;
   int spread=MarketInfo(Symbol(),MODE_SPREAD);
           
   if (Ask < DailyWL)   
   {
      ticket=OrderSend(Symbol(),OP_BUY,PositionSize,Ask,4,0,Ask+(TP+spread+breath)*Point,"Brijon Long Trade",MagicNObase,0,Blue);      // Ask - Mountain*Point
      if(ticket>0) 
      {
         if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) 
            {Print("BUY order opened : ",OrderOpenPrice());}
         else 
            {Print("Error opening BUY order : ",GetLastError());} 
      } 
   }
   else if (Bid > DailyWL)
   { 
      ticket=OrderSend(Symbol(),OP_SELL,PositionSize,Bid,4,0,Bid-(TP+spread+breath)*Point,"Brijon Short Trade",MagicNObase,0,Blue); 
      if(ticket>0)
      {
         if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) 
            {Print("SELL order opened : ",OrderOpenPrice());}
         else 
            {Print("Error opening SELL order : ",GetLastError());}  
      }     
   }   
   
 }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---