Download MetaTrader 5

Time Sensitive help needed...

To add comments, please log in or register
Find out how to install MetaTrader on Linux
Jaylen Jennings
805
Jaylen Jennings 2015.10.25 12:05 
Good day users,

I have been trying to learn how to code very recently. I am not sure of much, but I wonder if anyone here has successfully coded a cross of two lines in the oscillate indicator. I just want the trade to be taken when a cross between line a and line b occurs in the overbought or oversold zone (lets say values over 80 and less than 20).  Any ideas?

Thanks ahead of time for any place for me to start. 
Doerk Hilger
1154
Doerk Hilger 2015.10.25 12:43  
16649609:
Good day users,

I have been trying to learn how to code very recently. I am not sure of much, but I wonder if anyone here has successfully coded a cross of two lines in the oscillate indicator. I just want the trade to be taken when a cross between line a and line b occurs in the overbought or oversold zone (lets say values over 80 and less than 20).  Any ideas?

Thanks ahead of time for any place for me to start. 
         //--- Mode Standard OSC            
               if (m_mode==0)
                  {
                  double smain=iStochastic(m_symbolname,m_timeframe,m_period_k,m_period_d,m_slowing,m_method,m_pricefield,MODE_MAIN,m_shift);
                  double ssignal=iStochastic(m_symbolname,m_timeframe,m_period_k,m_period_d,m_slowing,m_method,m_pricefield,MODE_SIGNAL,m_shift);
                  double stoch=0;
                  if (smain>100-m_signal && smain<ssignal) 
                     stoch=-100+(MathMax(smain,ssignal)*2);
                  else if (smain<m_signal && smain>ssignal)
                     stoch=-100+(MathMin(smain,ssignal)*2);
                  return -stoch;
                  }

This is a snippet of one of my signal classes. It will return a value between +100 (long) and -100 (short) which indicates the strength of the signal, 0 means no signal. It does exactly what you asked for. You just have to change the variable names to your needs, whereby m_signal is the distance to overbought/oversold maximum of 100 and 0. If you set m_signal to 20 it means, 80 and 20 are used and if the lines cross above/below 80 and 20, the variable "stoch" will be >0 / <0, otherwise it´s zero.

PS: If you´re looking for algorithms, take a look at the signal classes of MT5/MQL5. I did not take my code from there, but anyway many algorithms of those classes should work fine. 

Jaylen Jennings
805
Jaylen Jennings 2015.10.25 13:10  
Doerk:

This is a snippet of one of my signal classes. It will return a value between +100 (long) and -100 (short) which indicates the strength of the signal, 0 means no signal. It does exactly what you asked for. You just have to change the variable names to your needs, whereby m_signal is the distance to overbought/oversold maximum of 100 and 0. If you set m_signal to 20 it means, 80 and 20 are used and if the lines cross above/below 80 and 20, the variable "stoch" will be >0 / <0, otherwise it´s zero.

PS: If you´re looking for algorithms, take a look at the signal classes of MT5/MQL5. I did not take my code from there, but anyway many algorithms of those classes should work fine. 

Jaylen Jennings
805
Jaylen Jennings 2015.10.25 13:13  
Wow. I really appreciate the information and advice and will definitely use both. I hope after learning more i can swing through here and help someone out as you have done for me. 

Thank you. 
Doerk Hilger
1154
Doerk Hilger 2015.10.25 13:30  
16649609:
Wow. I really appreciate the information and advice and will definitely use both. I hope after learning more i can swing through here and help someone out as you have done for me. 

Thank you. 

You´re welcome :) But maybe you should have a name instead of a user-number ;)

Doerk 

Jaylen Jennings
805
Jaylen Jennings 2015.10.25 13:43  
Done
Jaylen Jennings
805
Jaylen Jennings 2015.10.25 16:47  

While working on this I am unsure of a couple term you used in the example you provided.  I will send you a private note to get a little clarity

 

Thanks

To add comments, please log in or register