if(iCustom(NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 0, i) != 0 && iCustom(NULL, PERIOD_CURRENT, NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 0, i) != EMPTY_VALUE
hi Nagisa,
made that error while copying it the code im using is. i think the error im having is i use "if" and "else" but the buffers 0,1 always show as a value. how would i over com this?
if(iCustom(NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 0, i) != 0 && iCustom(NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 0, i) != EMPTY_VALUE
hi Nagisa,
made that error while copying it the code im using is. i think the error im having is i use "if" and "else" but the buffers 0,1 always show as a value. how would i over com this?
I can't give you any advice based on this one line alone.
I can't give you any advice based on this one line alone.
hi mate,
thanks for your reply this is the code im trying to get to work
//+------------------------------------------------------------------+ //| Indicator: moving av.mq4 | //| Created with EABuilder.com | //| https://www.eabuilder.com | //+------------------------------------------------------------------+ #property copyright "Created with EABuilder.com" #property link "https://www.eabuilder.com" #property version "1.00" #property description "" #include <stdlib.mqh> #include <stderror.mqh> //--- indicator settings #property indicator_chart_window #property indicator_buffers 2 #property indicator_type1 DRAW_ARROW #property indicator_width1 5 #property indicator_color1 0xFFAA00 #property indicator_label1 "Buy" #property indicator_type2 DRAW_ARROW #property indicator_width2 1 #property indicator_color2 0x0000FF #property indicator_label2 "sell" //--- indicator buffers double Buffer1[]; double Buffer2[]; double myPoint; //initialized in OnInit void myAlert(string type, string message) { if(type == "print") Print(message); else if(type == "error") { Print(type+" | moving av @ "+Symbol()+","+IntegerToString(Period())+" | "+message); } else if(type == "order") { } else if(type == "modify") { } } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { IndicatorBuffers(2); SetIndexBuffer(0, Buffer1); SetIndexEmptyValue(0, EMPTY_VALUE); SetIndexArrow(0, 252); SetIndexBuffer(1, Buffer2); SetIndexEmptyValue(1, EMPTY_VALUE); SetIndexArrow(1, 241); //initialize myPoint myPoint = Point(); if(Digits() == 5 || Digits() == 3) { myPoint *= 10; } return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime& time[], const double& open[], const double& high[], const double& low[], const double& close[], const long& tick_volume[], const long& volume[], const int& spread[]) { int limit = rates_total - prev_calculated; //--- counting from 0 to rates_total ArraySetAsSeries(Buffer1, true); ArraySetAsSeries(Buffer2, true); //--- initial zero if(prev_calculated < 1) { ArrayInitialize(Buffer1, EMPTY_VALUE); ArrayInitialize(Buffer2, EMPTY_VALUE); } else limit++; //--- main loop for(int i = limit-1; i >= 0; i--) { if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation //Indicator Buffer 1 if(iCustom(NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 6, i) != 0 && iCustom(NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 6, i) != EMPTY_VALUE //TrendWave is not equal to fixed value ) { Buffer1[i] = Low[1+i]; //Set indicator value at Candlestick Low } else { Buffer1[i] = EMPTY_VALUE; } //Indicator Buffer 2 if(iCustom(NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 7, i) != 0 && iCustom(NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 7, i) != EMPTY_VALUE //TrendWave is not equal to fixed value ) { Buffer2[i] = High[1+i]; //Set indicator value at Candlestick High } else { Buffer2[i] = EMPTY_VALUE; } } return(rates_total); } //+------------------------------------------------------------------+
I have made significant modifications to two programs.
Hi Nagisa,
Thank you so much mate, i really appriciate the time and effort you put into making the changes.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
Im trying to call the blue and yellow buffers for the attached indicator, im using icustom like this
"//Indicator Buffer 1
if(iCustom(NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 0, i) != 0 && iCustom(NULL, PERIOD_CURRENT, "trend-wave", 10, 21, false, false, 0, i) != EMPTY_VALUE "
but the buffer isnt read.
any idea why that would be?