Metatrader 5 coding questions / issues - page 17

 

Please Convert!!!

Could Someone PLEASE PLEASE PLEASE convert this indicator to MQL5??? I would greatly appreciate it

 
endymion:
Could Someone PLEASE PLEASE PLEASE convert this indicator to MQL5??? I would greatly appreciate it

endymion

That indicator repaints

 

Hi, I find the SMI with alerts and arrows very helpful, better than a normal Stochastic. A question to the programmers, can someone make a MTF version in MQ5 ?

Many thanks!

smi_osma_alertsarrows.mq4

 

Hi mladen could u be kind enough to convert ur own rsi+pivot.mq4 to mq5

rsi__pivots.mq4

Thanks & regards

Privateer

Files:
 

Does anyone have currency strength indicator for metatrader 5?

 

Hi, is it possible to make this indicator with alert and arrows if cross both lines? THX !

blau_sm_stochastic.mq5

Files:
 
sgvg23:
Hi, is it possible to make this indicator with alert and arrows if cross both lines? THX ! blau_sm_stochastic.mq5

This file needed for the upper in order to be compiled

Files:
 

Hi mladen, i have this two file

blau_sm_stochastic.mq5

williamblau.mqh

Files:
 

Hello everybody, What's wrong in this trivial indicator? Why I can only see one indicator instead of 2 sma?

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

//| Gio_Trand.mq4 |

//| Copyright 2013, MetaQuotes Software Corp. |

//| |

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

#property copyright "Copyright 2013, MetaQuotes Software Corp."

#property version "1.00"

#property strict

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_plots 2

//--- plot SMA

#property indicator_label1 "media"

#property indicator_type1 DRAW_LINE

#property indicator_color1 Red

#property indicator_style1 STYLE_SOLID

#property indicator_width1 1

#property indicator_label2 "MediaDiMedia"

#property indicator_type2 DRAW_LINE

#property indicator_color2 Green

#property indicator_style2 STYLE_SOLID

#property indicator_width2 1

#include

//--- input parameters

input int mioperiod=3;

input ENUM_MA_METHOD tipoSMA=MODE_SMMA;

input ENUM_APPLIED_PRICE mioapplied_price=PRICE_WEIGHTED;

//--- indicator buffers

double SMABuffer[];

double MediaDiMedia[];

//double temp[];

int iMA_handle;

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

//| Custom indicator initialization function |

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

int OnInit()

{

//--- indicator buffers mapping

SetIndexBuffer(0,SMABuffer,INDICATOR_DATA);

SetIndexBuffer(1,MediaDiMedia,INDICATOR_DATA);

// SetIndexBuffer(2,temp,INDICATOR_CALCULATIONS);

//SetIndexStyle(0,DRAW_LINE);

// PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);

// PlotIndexSetInteger(0,PLOT_LINE_WIDTH,2);

// PlotIndexSetInteger(0,PLOT_LINE_COLOR,DeepPink);

//--- set accuracy

//IndicatorSetInteger(INDICATOR_DIGITS,2);

//--- sets first bar from what index will be drawn

// PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,mioperiod);

ArraySetAsSeries(SMABuffer,true);

ArraySetAsSeries(MediaDiMedia,true);

iMA_handle=iMA(Symbol(),0,mioperiod,0,tipoSMA,mioapplied_price);

//---

return(0);

}

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

//| Custom indicator iteration function |

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

int OnCalculate(const int rates_total,// size of input time series

const int prev_calculated,// bars handled in previous call

const datetime &time[],// Time

const double &open[],

const double &high[],

const double &low[],

const double &close[],

const long &tick_volume[],

const long &volume[],

const int &spread[])

{

ArraySetAsSeries(open,true);

ArraySetAsSeries(high,true);

ArraySetAsSeries(low,true);

ArraySetAsSeries(close,true);

ArraySetAsSeries(time,true);

ArraySetAsSeries(tick_volume,true);

ArraySetAsSeries(spread,true);

double Ask,Bid;

Ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);

Bid = SymbolInfoDouble(Symbol(),SYMBOL_BID);

int Bars=rates_total;

int IndicatorCounted=prev_calculated;

int copied=CopyBuffer(iMA_handle,0,0,rates_total,SMABuffer);

int ret=SimpleMAOnBuffer(Bars,0,0,mioperiod,SMABuffer,MediaDiMedia);

// for(int i=Bars-1;i>=0;i--) MediaDiMedia= temp;

//--- return value of prev_calculated for next call

return(rates_total);

}

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

 
gioooooo:
Hello everybody, What's wrong in this trivial indicator? Why I can only see one indicator instead of 2 sma?

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

//| Gio_Trand.mq4 |

//| Copyright 2013, MetaQuotes Software Corp. |

//| |

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

#property copyright "Copyright 2013, MetaQuotes Software Corp."

#property version "1.00"

#property strict

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_plots 2

//--- plot SMA

#property indicator_label1 "media"

#property indicator_type1 DRAW_LINE

#property indicator_color1 Red

#property indicator_style1 STYLE_SOLID

#property indicator_width1 1

#property indicator_label2 "MediaDiMedia"

#property indicator_type2 DRAW_LINE

#property indicator_color2 Green

#property indicator_style2 STYLE_SOLID

#property indicator_width2 1

#include

//--- input parameters

input int mioperiod=3;

input ENUM_MA_METHOD tipoSMA=MODE_SMMA;

input ENUM_APPLIED_PRICE mioapplied_price=PRICE_WEIGHTED;

//--- indicator buffers

double SMABuffer[];

double MediaDiMedia[];

//double temp[];

int iMA_handle;

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

//| Custom indicator initialization function |

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

int OnInit()

{

//--- indicator buffers mapping

SetIndexBuffer(0,SMABuffer,INDICATOR_DATA);

SetIndexBuffer(1,MediaDiMedia,INDICATOR_DATA);

// SetIndexBuffer(2,temp,INDICATOR_CALCULATIONS);

//SetIndexStyle(0,DRAW_LINE);

// PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);

// PlotIndexSetInteger(0,PLOT_LINE_WIDTH,2);

// PlotIndexSetInteger(0,PLOT_LINE_COLOR,DeepPink);

//--- set accuracy

//IndicatorSetInteger(INDICATOR_DIGITS,2);

//--- sets first bar from what index will be drawn

// PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,mioperiod);

ArraySetAsSeries(SMABuffer,true);

ArraySetAsSeries(MediaDiMedia,true);

iMA_handle=iMA(Symbol(),0,mioperiod,0,tipoSMA,mioapplied_price);

//---

return(0);

}

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

//| Custom indicator iteration function |

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

int OnCalculate(const int rates_total,// size of input time series

const int prev_calculated,// bars handled in previous call

const datetime &time[],// Time

const double &open[],

const double &high[],

const double &low[],

const double &close[],

const long &tick_volume[],

const long &volume[],

const int &spread[])

{

ArraySetAsSeries(open,true);

ArraySetAsSeries(high,true);

ArraySetAsSeries(low,true);

ArraySetAsSeries(close,true);

ArraySetAsSeries(time,true);

ArraySetAsSeries(tick_volume,true);

ArraySetAsSeries(spread,true);

double Ask,Bid;

Ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);

Bid = SymbolInfoDouble(Symbol(),SYMBOL_BID);

int Bars=rates_total;

int IndicatorCounted=prev_calculated;

int copied=CopyBuffer(iMA_handle,0,0,rates_total,SMABuffer);

int ret=SimpleMAOnBuffer(Bars,0,0,mioperiod,SMABuffer,MediaDiMedia);

// for(int i=Bars-1;i>=0;i--) MediaDiMedia= temp;

//--- return value of prev_calculated for next call

return(rates_total);

}

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

been testing it (even made this very simplified version) and it still has an error. For now it seems as if "one of those things" that metatrader 5 can do sometimes and when it takes you days to find our what is going on (in any case, SimpleMAOnArray() is returning nonsense results).

What is funny is that it returns proper results when you use EMA as a basic average type (for iMA() function) In all the other cases it returns wrong values

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

//| Gio_Trand.mq4 |

//| Copyright 2013, MetaQuotes Software Corp. |

//| |

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

#property copyright "Copyright 2013, MetaQuotes Software Corp."

#property version "1.00"

//#property strict

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_plots 2

//--- plot SMA

#property indicator_label1 "sma"

#property indicator_type1 DRAW_LINE

#property indicator_color1 Red

#property indicator_style1 STYLE_SOLID

#property indicator_width1 1

#property indicator_label2 "sma of sma"

#property indicator_type2 DRAW_LINE

#property indicator_color2 Green

#property indicator_style2 STYLE_SOLID

#property indicator_width2 1

#include

//--- input parameters

input int mioperiod=15;

input ENUM_MA_METHOD tipoSMA=MODE_SMMA;

input ENUM_APPLIED_PRICE mioapplied_price=PRICE_WEIGHTED;

//--- indicator buffers

double SMABuffer[];

double MediaDiMedia[];

int iMA_handle;

//------------------------------------------------------------------

//

//------------------------------------------------------------------

int OnInit()

{

SetIndexBuffer(0,SMABuffer,INDICATOR_DATA);

SetIndexBuffer(1,MediaDiMedia,INDICATOR_DATA);

iMA_handle=iMA(Symbol(),0,mioperiod,0,tipoSMA,mioapplied_price);

return(0);

}

int OnCalculate(const int rates_total, // size of input time series

const int prev_calculated, // bars handled in previous call

const datetime &time[], // Time

const double &open[],

const double &high[],

const double &low[],

const double &close[],

const long &tick_volume[],

const long &volume[],

const int &spread[])

{

if (BarsCalculated(iMA_handle)<rates_total) return(0);

if (CopyBuffer(iMA_handle,0,0,rates_total,SMABuffer)>0)

SimpleMAOnBuffer(rates_total,prev_calculated,0,mioperiod,SMABuffer,MediaDiMedia);

return(rates_total);