Download MetaTrader 5

MTF Stoch Level Alert Indicator - Help Needed Please

To add comments, please log in or register
johncouchman
13
johncouchman  

I've coded an indicator which some of you might find useful when trading with Stochs

The 4H, 30M & 5M are all above the 50 level & when the 1M time frame is below the 20 level for a long trade.

Or

The 4H, 30M & 5M are all below the 50 level & when the 1M time frame is above the 80 level for a long trade.

The indicator works perfectly, However I am looking for someone you could possibly insert a few more lines of code so when the long parameters are met an upwards arrow is shown on the chat and when the short parameters are met a downwards arrow is shown on the chart. I would be extremely grateful if someone could help me with this. I've spent hours trying but do not know enough about programming to be able to achieve this! I know there's some great programmers on his forum!

//+------------------------------------------------------------------+

//| Stochs_4H_30M_5M_1M.mq4

//+------------------------------------------------------------------+

#property copyright ""

#property indicator_chart_window

datetime lastbar;

bool EmailSent;

extern bool EmailAlert;

extern bool SoundON;

extern double highlimit = 80;

extern double midlimit = 50;

extern double lowlimit = 20;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

Comment ("Stochastic +/- 80/20 Signal Indicator ON");

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

Comment ("");

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

int counted_bars=IndicatorCounted();

//----

double main_M1 = iStochastic(NULL,PERIOD_M1,5,1,3,MO DE_SMA,0,MODE_MAIN,0);

double signal_M1 = iStochastic(NULL,PERIOD_M1,5,1,3,MO DE_SMA,0,MODE_SIGNAL,0);

double main_M5 = iStochastic(NULL,PERIOD_M5,5,1,3,MO DE_SMA,0,MODE_MAIN,0);

double signal_M5 = iStochastic(NULL,PERIOD_M5,5,1,3,MO DE_SMA,0,MODE_SIGNAL,0);

double main_M30 = iStochastic(NULL,PERIOD_M30,5,1,3,M ODE_SMA,0,MODE_MAIN,0);

double signal_M30 = iStochastic(NULL,PERIOD_M30,5,1,3,M ODE_SMA,0,MODE_SIGNAL,0);

double main_H4 = iStochastic(NULL,PERIOD_H4,5,1,3,MO DE_SMA,0,MODE_MAIN,0);

double signal_H4 = iStochastic(NULL,PERIOD_H4,5,1,3,MO DE_SMA,0,MODE_SIGNAL,0);

datetime curbar = Time[0];

if (lastbar != curbar)

{

lastbar = curbar;

if ((main_H4 < midlimit) && (main_M30 < midlimit) && (main_M5 highlimit))

if ((signal_H4 < midlimit) && (signal_M30 < midlimit) && (signal_M5 highlimit))

{

Alert ("Short Entry Warning On ",Symbol()," ",Period()," min");

if (EmailAlert && !EmailSent)

{

SendMail("Short","Short Entry Warning On " + (StringConcatenate(Symbol()," ",Period())));

EmailSent = true;

}

if (SoundON == true) PlaySound ("alert2.wav");

}

if ((main_H4 > midlimit) && (main_M30 > midlimit) && (main_M5 > midlimit) && (main_M1 < lowlimit))

if ((signal_H4 > midlimit) && (signal_M30 > midlimit) && (signal_M5 > midlimit) && (signal_M1 < lowlimit))

{

Alert ("Long Entry Warning On ",Symbol()," ",Period()," min");

if (EmailAlert && !EmailSent)

{

SendMail("Long","Long Entry Warning On " + (StringConcatenate(Symbol()," ",Period())));

EmailSent = true;

}

if (SoundON == true) PlaySound ("alert2.wav");

}

}

//----

return(0);

}

//+------------------------------------------------------------------+

To add comments, please log in or register