Discussion of article "The NRTR indicator and trading modules based on NRTR for the MQL5 Wizard"
Published article NRTR indicator and trading modules based on it for MQL5 Wizard:
Author: Dmitrii Troshin
I don't understand how to access it via iCustom ... please explain
there should be something like
double iCustom (
stringsymbol, // symbol name
int timeframe, // timeframe
stringname, // folder/user indicator name
... // list of indicator input parameters
int mode, // data source
int shift// shift
);
that is specifically in our case
//+------------------------------------------------------------------+ //| NRTRvolatile| //+------------------------------------------------------------------+ //iBufferNumber //0 //1 //2 - signal up //3 - signal down double indNRTRvolatile(string sSymbol=NULL, int tf=PERIOD_M5, int period=12, //dynamic period double K=1, //scale factor int iBufferNumber=0, int iShift=0) { ENUM_TIMEFRAMES timeframe=TFMigrate(tf); double handle=iCustom(sSymbol,timeframe,"NRTRvolatile",period,K,iBufferNumber,iShift); if(handle<0) { Print("NRTRvolatile object not created: Error ",GetLastError()); return(-1); } else return(CopyBufferMQL4(handle,0,iShift)); }
only gives out some nonsense, i.e. current prices if you refer to buffer 2 or 3
I don't understand how to access it via iCustom ... please explain
Buffers 2,3 contain signals that are updated only at the moment of trend change.
Support/Resistance are in buffers 0,1 - these are the lines we see as lines
CopyBuffer() - has three overloads, but none of them has three parameters.
A variant of the code to get the values of the buffers
void OnStart() { double arr[]; int handle =iCustom(Symbol(),0,"NRTRvolatile",12,1); CopyBuffer(handle,0,0,1,arr); Print("Lower Canal ",arr[0]); CopyBuffer(handle,1,0,1,arr); Print("Upper Canal ",arr[0]); CopyBuffer(handle,2,0,1,arr); Print("Signal up.",arr[0]); CopyBuffer(handle,3,0,1,arr); Print("Signal Down.",arr[0]); }
This is the script
Buffers 2,3 contain signals that are updated only at the moment of trend change.
Support/Resistance are in buffers 0,1 - these are the lines we see as lines
CopyBuffer() - has three overloads, but none of them has three parameters.
A variant of the code to get the values of the buffers
This is a script
Yes, it's clearer now.
about CopyBuffer - it is from mql4 compatibility library, more precisely from initmql4__1.mqh.
double CopyBufferMQL4(int handle,int index,int shift) { double buf[]; switch(index) { case 0: if(CopyBuffer(handle,0,shift,1,buf)>0) return(buf[0]); break; case 1: if(CopyBuffer(handle,1,shift,1,buf)>0) return(buf[0]); break; case 2: if(CopyBuffer(handle,2,shift,1,buf)>0) return(buf[0]); break; case 3: if(CopyBuffer(handle,3,shift,1,buf)>0) return(buf[0]); break; case 4: if(CopyBuffer(handle,4,shift,1,buf)>0) return(buf[0]); break; default: break; } return(EMPTY_VALUE); }
probably so
//+------------------------------------------------------------------+ //| NRTRvolatile| //+------------------------------------------------------------------+ //iBufferNumber //0 //1 //2 - signal up //3 - signal down double indNRTRvolatile(string sSymbol=NULL, int tf=PERIOD_M5, int period=12, //dynamic period double K=1, //scale factor int iBufferNumber=0, int iShift=0) { ENUM_TIMEFRAMES timeframe=TFMigrate(tf); double handle=iCustom(sSymbol,timeframe,"NRTRvolatile",period,K); if(handle<0) { Print("NRTRvolatile object not created: Error ",GetLastError()); return(-1); } else return(CopyBufferMQL4(handle,iBufferNumber,iShift));}
Is it possible to upgrade NRTRvolatile so that a message box pops up when an arrow is added?
Is it possible to upgrade NRTRvolatile so that a message box pops up when adding an arrow?
Perhaps in the LongCondition and ShortCondition functions.
int SignalNRTR::LongCondition(void) { int idx =StartIndex(); if(UpSignal(idx)) { Alert"Text"; return 100; } else return 0; }
to add something like Alert"Text". I don't know if it will work. The thing is that I don't have this code on my computer anymore. Everything that I had last year I put away in the past:) So I can't try it. And I still have New Year's Eve ringing in my head :)
In the indicator itself, somewhere around here
// trend changes if(trend>0) Buff_Up[i]=value; if(trend<0) Buff_Dn[i]=value; if(trend_prev<0 && trend>0) { Alert("Text"); Sign_Up[i]=value; Buff_Up[i]=0.0; } if(trend_prev>0 && trend<0) { Alert("Text"); Sign_Dn[i]=value; Buff_Dn[i]=0.0; }
The path to the includefiles should be corrected to
#include <Expert\\ExpertSignal.mqh>
both variants are possible. Right variant
#include <Expert\ExpertSignal.mqh>you can see it in another modules in folder Include\Expert\Signal
New article The NRTR indicator and trading modules based on NRTR for the MQL5 Wizard has been published:
In this article we are going to analyze the NRTR indicator and create a trading system based on this indicator. We are going to develop a module of trading signals that can be used in creating strategies based on a combination of NRTR with additional trend confirmation indicators.
Let's check the indicator operation by launching on one chart two NRTRs with different parameters: the first NRTR has the period of 12 and the width of 0.1%; the second NRTR's period is 120 and the width is 0.2%.
Author: Dmitrii Troshin