Brooklyn, NY USA
Experience: Intermediate
Platform: NinjaTrader
Trading: Forex EUR/USD
Posts: 12 since Mar 2012
Thanks Given: 1
Thanks Received: 1
|
vegasfoster,
I think I may understand the logic. I figure the best way to understand this is to do as much on my own as possible, so I did some brainstorming. Please, at your convenience, let me know if my understanding of the logic is correct.
int crossup = SMA(6)[0] > SMA(18)[0] && SMA(6)[1] < SMA(18)[1] ? 1 : 0;
int crossdown = SMA(6)[0] < SMA(18)[0] && SMA(6)[1] > SMA(18)[1] ? 1 : 0;
Logic: If statement is true value = "1", otherwise it's "0"
Cross1[0] = crossup ==1 || crossdown ==1 ? SMA(18)[0] : Cross1[1];
Logic: whether there's an SMA(18) crossover up or down, value will = SMA(18)[0] price level
which is stored as the 2nd and current SMA crossover price level (Cross1[0])...
... otherwise if the crossover SMA(18) value is not current (1 bar or more ago), it
will be stored as "Cross1[1]", the most recent and last SMA(18) crossover price level.
Cross2[0] = crossup ==1 || crossdown ==1 ? Cross1[1] : Cross2[1];
Logic: whether there's an SMA XO up or down, if a fresh current SMA(18) crossover took place
"Cross1[1]" then becomes the prior SMA(18) crossover price level and
"Cross1[0]" then becomes the current SMA(18) crossover price level
... otherwise when SMA(18) crossover is 1 bar old or more,
"Cross2[1]" becomes the stored prior SMA(18) crossover price level and
"Cross1[1]" becomes the most recent and last SMA(18) crossover price level.
|