chm - 15 min intraday

Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
Indicators Used
Moving average indicatorStochastic oscillatorRelative strength indexMACD HistogramMoving Average of Oscillator
0 Views
0 Downloads
0 Favorites

Profitability Reports

GBP/USD Oct 2024 - Jan 2025
47.00 %
Total Trades 126
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -10.44
Gross Profit 1144.00
Gross Loss -2460.00
Total Net Profit -1316.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%
chm - 15 min intraday
//+------------------------------------------------------------------+
//|                                              15 min intraday     |
//+------------------------------------------------------------------+


extern double Lots = 1;
extern double TP_b = 26;
extern double StopLoss_b = 30;
extern double TP_s = 22;
extern double StopLoss_s = 16;
extern int cur_per = 1;
extern int waittime = 1000;
extern int trade_sides = 1;          // buy only = 1, sell only = 2, both options = 3
extern int start_hour = 13;
extern int end_hour = 17;
extern int slippage = 0;

//+------------------------------------------------------------------+
//| Start function                                                   |
//+------------------------------------------------------------------+
int start()
   {
// initialize
   
   int i=0;
   int ticket;
   int x;
   int y;
   int hstTotal;
   double fiveWMA[3];
   double tenSMA[3];
   double Slow1[3];
   double Slow2[3];
   double RSI[3];
   double macd_sig[3];
   double macd[3];
   double macd_hist[3];
   datetime ctm;

// Checks for trading ...

   if(Bars<25) 
      return;
   if(OrdersTotal() > 0) 
      return;
   if (Hour() < start_hour || Hour() >= end_hour)
      return;
   hstTotal=HistoryTotal();

   OrderSelect(hstTotal,SELECT_BY_TICKET,MODE_HISTORY);
   ctm=OrderCloseTime();

   if (CurTime() - ctm < waittime)
      return;


   if (cur_per == 0)
      {
      x = 1;
      y = 2;
      }
   else
      {
      x = 0;
      y = 1;
      }
   
// load Arrays 
   while (i<3)
      {
      fiveWMA[i] = iMA(NULL,0,3,0,MODE_LWMA,PRICE_CLOSE,i);
      tenSMA[i] = iMA(NULL,0,7,0,MODE_SMA,PRICE_CLOSE,i);
      Slow1[i] = iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_MAIN,i);
      Slow2[i] = iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_SIGNAL,i);
      RSI[i] = iRSI(NULL,0,9,PRICE_CLOSE,i);
      macd_sig[i] = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,i);
      macd[i] = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i);
      macd_hist[i] = iOsMA(NULL,0,12,26,9,PRICE_CLOSE,i);
      i++;
      }

// Check for Buy criteria   
   if (fiveWMA[y] > tenSMA[y]    && 
      Slow1[x] > Slow1[y]        &&
      Slow2[x] > Slow2[y]        &&
      RSI[x] > 50                &&
      macd_hist[x] > 0           &&
      macd_sig[x] > macd_sig[y]  &&
      macd[x] > macd[y]          &&
      trade_sides != 2
                                     )
      {
// Place Buy
      ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,slippage,Ask-StopLoss_b*Point,Ask+TP_b*Point,"Auto: 15minIntra v2");
      if (ticket<0)
         {
         Print("OrderSend failed with error #",GetLastError());
         return;
         }
      }
//Check for Sell criteria
      
   if (fiveWMA[y] < tenSMA[y]    && 
      Slow1[x] < Slow1[y]        &&
      Slow2[x] < Slow2[y]        &&
      RSI[x] < 50                &&
      macd_hist[x] < 0           &&
      macd_sig[x] < macd_sig[y]  &&
      macd[x] < macd[y]          &&
      trade_sides != 1
                                     )
      {
// Place Sell
      ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,slippage,Bid+StopLoss_s*Point,Bid-TP_s*Point,"Auto: 15minIntra v2");
//      Print("Current Time is ",CurTime());
      if (ticket<0)
         {
         Print("OrderSend failed with error #",GetLastError());
         return;
         }
      }   
   }         

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