Forex_Runner

Orders Execution
It automatically opens orders when conditions are reachedChecks for the total of open orders
Indicators Used
Fractals
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
Forex_Runner

extern int     Delta = 30;
extern int     SL    = 20;
extern int     TP    = 40;

double         LHFU, LLFD;        // LastHighFractalUp, LastLowFractalDown
double         SS_OpnPrx, BS_OpnPrx;
int            JT_SL,                                 // Jumlah Trades Sell Limit
               JT_BL,                                 // Jumlah Trades Buy Limit
               JT_SS,                                 // Jumlah Trades Sell Stop
               JT_BS,                                 // Jumlah Trades Buy Stop
               JT_OS,                                 // Jumlah Trades Open Sell
               JT_OB;                                 // Jumlah Trades Open Buy
               
int start()
{
   ChkAllTrd();
   if (JT_OS<=0 && JT_OB<=0)                          // tdk ada open posisi
   {
      FindLastFractal();
      if (LHFU>0)                                     // ada fractal up
      {
         if (JT_BS>0)                        HapusBuyStop();
         Print ("LHFU...: "+LHFU);
         Print ("SS Open: "+ChkOrderOpnPrx("SS"));
         if (ChkOrderOpnPrx("SS")>0 && ChkOrderOpnPrx("SS")!=LHFU-(Delta*Point))     HapusSellStop();
         if (JT_SS<=0)
         {
            SS_OpnPrx   =  LHFU-(Delta*Point);
            OrderSend(Symbol(),OP_SELLSTOP,1,SS_OpnPrx,0,SS_OpnPrx+(SL*Point),SS_OpnPrx-(TP*Point),"Sell",0,0,Red);
         }
      }
   
      if (LLFD>0)                                     // ada fractal dn
      {
         if (JT_SS>0)                        HapusSellStop();
         Print ("LLFD...: "+LLFD);
         Print ("BS Open: "+ChkOrderOpnPrx("BS"));
         if (ChkOrderOpnPrx("BS")>0 && ChkOrderOpnPrx("BS")!=LLFD+(Delta*Point))     HapusBuyStop();
         if (JT_BS<=0)
         {
            BS_OpnPrx   =  LLFD+(Delta*Point);
            OrderSend(Symbol(),OP_BUYSTOP,1,BS_OpnPrx,0,BS_OpnPrx-(SL*Point),BS_OpnPrx+(TP*Point),"Buy",0,0,Blue);
         }
      }
   }
   return(0);
}

void FindLastFractal()
{
   double   val1;
   double   val2;
   int      i;
   i     = Bars;
   LHFU  = 0;
   LLFD  = 0;
   while(i>=0)
   {
      val1 = iFractals(NULL, 0, MODE_UPPER,i);
      if (val1 > 0)  LHFU  =  High[i];
  
      val2 = iFractals(NULL, 0, MODE_LOWER,i);
      if (val2 > 0)  LLFD  =  Low[i];
      
      if (LHFU>0 || LLFD>0)   break;
      else                    i--;
   } 
}

void ChkAllTrd()
{
   int ecnt, total;
   JT_SL=0;
   JT_BL=0;
   JT_SS=0;
   JT_BS=0;
   JT_OS=0;
   JT_OB=0;
   total=OrdersTotal();
   for (ecnt=0;ecnt<total;ecnt++)
   {
      OrderSelect(ecnt,SELECT_BY_POS, MODE_TRADES);
      if       (OrderType()==OP_SELLLIMIT && OrderSymbol()==Symbol())
         JT_SL++;
      else if  (OrderType()==OP_BUYLIMIT  && OrderSymbol()==Symbol())
         JT_BL++;         
      else if  (OrderType()==OP_SELLSTOP  && OrderSymbol()==Symbol())
         JT_SS++;
      else if  (OrderType()==OP_BUYSTOP   && OrderSymbol()==Symbol())
         JT_BS++;         
      else if  (OrderType()==OP_SELL      && OrderSymbol()==Symbol())
         JT_OS++;
      else if  (OrderType()==OP_BUY       && OrderSymbol()==Symbol())
         JT_OB++;         
   }
}

void HapusSellStop()
{
   int total=OrdersTotal();
   int ecnt;
   for (ecnt=0;ecnt<total;ecnt++)
   {
      OrderSelect(ecnt,SELECT_BY_POS, MODE_TRADES);
      if  (OrderType()==OP_SELLSTOP  && OrderSymbol()==Symbol())  OrderDelete(OrderTicket());
   }
}

void HapusBuyStop()
{
   int total=OrdersTotal();
   int ecnt;
   for (ecnt=0;ecnt<total;ecnt++)
   {
      OrderSelect(ecnt,SELECT_BY_POS, MODE_TRADES);
      if  (OrderType()==OP_BUYSTOP   && OrderSymbol()==Symbol())  
      {
         OrderDelete(OrderTicket());
      }
   }
}

double ChkOrderOpnPrx(string Tipe)
{
   int ecnt;
   for (ecnt=0;ecnt<OrdersTotal();ecnt++)
   {
      OrderSelect(ecnt,SELECT_BY_POS, MODE_TRADES);
      if (Tipe=="SS" && OrderType()==OP_SELLSTOP && OrderSymbol()==Symbol())   return(OrderOpenPrice());
      if (Tipe=="BS" && OrderType()==OP_BUYSTOP  && OrderSymbol()==Symbol())   return(OrderOpenPrice());
   }
}

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