The indicator "testwindow" works on both so why doesn't iCustom pick up the value?
The indicator "testwindow" works on both so why doesn't iCustom pick up the value?
2.
I put those in as 4,7 in the above.
Attached
//+------------------------------------------------------------------+ //| testwindow.mq4 | //| Copyright © 2005, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Black //---- input parameters extern int First_R=4; extern int Second_S=7; //---- buffers double TSI_Buffer[]; double MTM_Buffer[]; double EMA_MTM_Buffer[]; double EMA2_MTM_Buffer[]; double ABSMTM_Buffer[]; double EMA_ABSMTM_Buffer[]; double EMA2_ABSMTM_Buffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(7); SetIndexBuffer(1, MTM_Buffer); SetIndexBuffer(2, EMA_MTM_Buffer); SetIndexBuffer(3, EMA2_MTM_Buffer); SetIndexBuffer(4, ABSMTM_Buffer); SetIndexBuffer(5, EMA_ABSMTM_Buffer); SetIndexBuffer(6, EMA2_ABSMTM_Buffer); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,TSI_Buffer); SetIndexLabel(0,"TSI"); //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit,i; limit=Bars-counted_bars-1; for (i=Bars-1;i>=0;i--) { MTM_Buffer[i]=Close[i]-Close[i+1];//iMomentum(NULL,0,1,PRICE_CLOSE,i); ABSMTM_Buffer[i]=MathAbs(MTM_Buffer[i]); //TSI_Buffer[i]=ABSMTM_Buffer[i]; } for (i=Bars-1;i>=0;i--) { EMA_MTM_Buffer[i]=iMAOnArray(MTM_Buffer,0,First_R,0,MODE_EMA,i); EMA_ABSMTM_Buffer[i]=iMAOnArray(ABSMTM_Buffer,0,First_R,0,MODE_EMA,i); //TSI_Buffer[i]=EMA_ABSMTM_Buffer[i]; } for (i=Bars-1;i>=0;i--) { EMA2_MTM_Buffer[i]=iMAOnArray(EMA_MTM_Buffer,0,Second_S,0,MODE_EMA,i); EMA2_ABSMTM_Buffer[i]=iMAOnArray(EMA_ABSMTM_Buffer,0,Second_S,0,MODE_EMA,i); //TSI_Buffer[i]=EMA2_ABSMTM_Buffer[i]; } for (i=Bars-1;i>=0;i--) { TSI_Buffer[i]=100.0*EMA2_MTM_Buffer[i]/EMA2_ABSMTM_Buffer[i]; } //---- TODO: add your code here //Comment (DoubleToStr(TSI_Buffer[0],5)); if ( (TSI_Buffer[0]>=75 || TSI_Buffer[0]<=-75) && GlobalVariableGet(Symbol()+"TSIAlerts"+Symbol()) < iTime(NULL,PERIOD_H1,0) ) { GlobalVariableSet(Symbol()+"TSIAlerts"+Symbol(), iTime(NULL,PERIOD_H1,0)); Alert("TSIAlert"); } //---- return(0); } //+------------------------------------------------------------------+
This is your problem . . . .
CrossDown[i] = iHigh(NULL,NULL,i) + 0.1500; // <-- this hard coded value } //buy //if (val <= -75) if (iCustom(Symbol(), Period(), "testwindow",4,7,0,i) <= BuyTestValue) { CrossUp[i] = iLow(NULL,NULL,i) - 0.1500; // <-- this hard coded value
your arrows are there, you just can't see them . . .
I can't think why this code would work on JPY pairs but not on the 5 decimal place pairs.
CrossDown[i] = iHigh(NULL,NULL,i) + 0.1500;//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.015 0.0150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers. } : crossUp[i] = iLow(NULL,NULL,i) - 15*pips2dbl;Why use a function call when the predefined array is identical iLow(NULL,NULL, i) == Low[i]
How can I get an indicator from the arrows to show how far price moves pat the arrow until the next arrow appears?
For example, if there is a buy arrow, I need to see how many pips on average price moves past that arrow until the next sell arrow signal is given.
Then I can work out some standard deviations and such.
You could . . .
Store the value for the current arrow, when the next appears calculate and plot the difference between the last arrow and the current, then store the value for the current arrow, repeat . .

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I can't think why this code would work on JPY pairs but not on the 5 decimal place pairs.
Any ideas?
The indicator "testwindow" works on both so why doesn't iCustom pick up the value?