roelfsch:
Trying to get a signal for dema crossing similar to ema crossing, but since iDEMA isn't available like iMA where I can just use "iMA(NULL, 0, 14, 0, MODE_SMA, PRICE_CLOSE, Current + 1)", I'm trying to create this myself.
I can get the values for dema on the first tick of each new bar, but not for the last bar, or 1 before that.
dema14_buffer[i]=iCustom(NULL,0,"dema",14,0,0);
What is the difference between the last argument in the iMA() call and the last argument in your iCustom() call, and why?
They should both be price shifts, so I think they are the same? (The iMA just sets it depending on the value of "Current" + 1)
I have tried this as well ...
int start() { double dema14; double dema14_1; //---- if (LastTradeBarTime == Time[0]) return(0); // Not <first detected tick> on this bar so quit else LastTradeBarTime = Time[0]; // and continue // dema 14 buffer, only need 2 or 3 bars dema14=iCustom(NULL,0,"dema",14,0,0); dema14_1=iCustom(NULL,0,"dema",14,0,1); Alert ("Dema 14 = " + dema14); Alert ("Dema 14_1 = " + dema14_1); //---- return(0); }
but the I still get this ...
Now I think that Dema 14_1 @ 16:50 should be equal to Dema 14 @ 16:45 as it should have shifted on the new bar. But from the screenshot you can see this is not so.
dema14_buffer[i]=iCustom(NULL,0,"dema",14,0,0);
You are ONLY looking at bar zero so of course you only get that "not for the last bar, or 1 before that"dema14=iCustom(NULL,0,"dema",14,0,0); dema14_1=iCustom(NULL,0,"dema",14,0,1);
You are only looking at the start of a bar, so the difference between dema(open[0]) and dema(close[1]) will always be very close, because close[1] and open[0] is one tick different.
-
You are ONLY looking at bar zero so of course you only get that "not for the last bar, or 1 before that"
-
You are only looking at the start of a bar, so the difference between dema(open[0]) and dema(close[1]) will always be very close, because close[1] and open[0] is one tick different.
Thanks, think I got it now, just had to shift another bar down so not to use the current bar.
dema14=iCustom(NULL,0,"dema",14,0,1);
dema14_1=iCustom(NULL,0,"dema",14,0,2);

- 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
Trying to get a signal for dema crossing similar to ema crossing, but since iDEMA isn't available like iMA where I can just use "iMA(NULL, 0, 14, 0, MODE_SMA, PRICE_CLOSE, Current + 1)", I'm trying to create this myself.
I can get the values for dema on the first tick of each new bar, but not for the last bar, or 1 before that. My idea was that the result of dema will be written to an array, and then I can just get the elements when needed with dema_array[0], dema_array[1] etc.
But that doesn't seem to work as both elements give the same value.