//+------------------------------------------------------------------+ //| 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; } } }
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Moving average indicator
Stochastic oscillator
Relative strength index
MACD Histogram
Moving Average of Oscillator
Custom Indicators Used:
Order Management characteristics:
Checks for the total of open orders
It automatically opens orders when conditions are reached
Other Features: