But it's a little obnoxious to have to pass two different IDataSeries, whether it's Close, Low, or High - also i have to remember which to do for key reversal up or key reversal down. Is there a way that I can reduce shrink this code a bit, where I just have to pass one dataseries? If so, how?
I realize that this is not a lot of code, but I am doing this so I can learn ninjascript.
Thanks,
Matt
Section 1
userdefinedmethods.cs
public bool IsKeyReversalUp (IDataSeries pricesClose, IDataSeries pricesLow){ if ( (pricesLow[0] <= pricesLow[1]) && pricesClose[0] > pricesClose[1]){ return true; }else return false; } public bool IsKeyReversalDown (IDataSeries pricesClose, IDataSeries pricesHigh){ if ( (pricesHigh[0] >= pricesHigh[1]) && pricesClose[0] < pricesClose[1]){ return true; }else return false; }
if (IsKeyReversalUp(Close, Low)) { DO SOMETHING } if (IsKeyReversalDown(Close, High)) { DO SOMETHING }
Comment