- MQL5 Wizard: Development of trading robots for MetaTrader 5
- Charts in MetaTrader 5 trading platform for Forex and stocks
- Technical analysis tools in MetaTrader 5
You can use function ChartIndicatorAdd():
ChartIndicatorAdd
Adds an indicator with the specified handle into a specified chart window.
bool ChartIndicatorAdd( |
Thanks! How do I change the indicator's line type and color once I've created it?
How to get Properties and parameters of an indicator on chart?
For example: an indicator Boll Band on chart, how to know the details of it such as: shift, deviations, apply price..., I say in MQL5
At the moment these features are not available from MQL5.
ResetLastError(); h_hashi1 = iCustom(Symbol(), PERIOD_M1, "heiken_ashi_tf1"); Print("h_hashi1 = ",h_hashi1," error = ",GetLastError()); //ChartIndicatorDelete(0,2,"heiken_ashi_tf1"); needed??? ChartIndicatorAdd(0,2,h_hashi1); // Heiken Ashi soll in Subwindow 2 ResetLastError(); h_hashi2 = iCustom(Symbol(), PERIOD_M5, "heiken_ashi_tf2"); Print("h_hashi2 = ",h_hashi2," error = ",GetLastError()); //ChartIndicatorDelete(0,3,"heiken_ashi_tf2"); ChartIndicatorAdd(0,3,h_hashi2); // Heiken Ashi soll in Subwindow 3
first try was with one file in indicators "heiken_ashi_tf" but it only loads one of the heiken ashi into my ea ;(
i also tought it is ab problem with instances and renamed the file to heiken_ashi_tf1 & heiken_ashi_tf2 for using with different handles like above...
in heiken_ashi_tf1 & heiken_ashi_tf2 is
#property indicator_chart_window //#property indicator_separate_window #property indicator_buffers 6 #property indicator_plots 1 #property indicator_type1 DRAW_COLOR_CANDLES #property indicator_color1 DodgerBlue, Red #property indicator_label1 "Open;High;Low;Close" //--- indicator buffers int ARR_VAL; int ARR_COUNTER; double ExtOBuffer[]; double ExtHBuffer[]; double ExtLBuffer[]; double ExtCBuffer[]; double ExtDBuffer[]; double ExtColorBuffer[]; //////////////////////////////////////////////////////////////////////////////////////////// // INIT void OnInit(){ //////////////////////////// ARR_VAL = 0; ARR_COUNTER = 0; SetIndexBuffer(0,ExtOBuffer,INDICATOR_DATA); SetIndexBuffer(1,ExtHBuffer,INDICATOR_DATA); SetIndexBuffer(2,ExtLBuffer,INDICATOR_DATA); SetIndexBuffer(3,ExtCBuffer,INDICATOR_DATA); SetIndexBuffer(4,ExtColorBuffer,INDICATOR_COLOR_INDEX); SetIndexBuffer(5,ExtDBuffer,INDICATOR_CALCULATIONS); IndicatorSetInteger(INDICATOR_DIGITS,_Digits); IndicatorSetString(INDICATOR_SHORTNAME,"heiken_ashi_tf1"); // in heiken_ashi_tf2 is shortname heiken_ashi_tf2 PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0); Print("heiken_ashi_tf1 loaded..."); // in heiken_ashi_tf2 output is heiken_ashi_tf2 loaded, both are shown } ....the problem is...
it loads only one heiken ashi, if i change the timeframe sometimes it shows both subwindows but with the same timeframe...
when both are shown, ich see in indikator shotname on my desktop that in subwindow 2 is heiken_ashi_tf1 an in subwindow 3 heiken_ashi_tf2 but both are the same, theres noch difference...
and it loads most time only one subwindow, handle gives no error...
any idea?
- votes: 10
- 2010.01.26
- MetaQuotes Software Corp. | English Russian Chinese Spanish Portuguese
- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use