firehawkco
New member
I have a variable "print" that should always be -1, 0, or 1. This variable plots correctly so long as I only have 1 case (waiting). As soon as I add another case (short), the variable seems to never have a value to plot. Help?!
Ruby:
declare lower;
input EntryChannel = 5;
input ExitChannel = 10;
input MovAvg = 23;
input Risk = 1000;
plot print;
def MP = {default waiting, short};
switch (MP)
{
case waiting:
if (close > PriceChannel("length" = EntryChannel)."UpperBand" and PriceChannel("length" = EntryChannel)."UpperBand" < SimpleMovingAvg(length = MovAvg))
{
MP = MP.waiting;
print = 1;
} else if
(close < PriceChannel("length" = EntryChannel)."LowerBand" and PriceChannel("length" = EntryChannel)."LowerBand" > SimpleMovingAvg(length = MovAvg))
{
MP = MP.short;
print = -1;
} else
{
MP = MP.waiting;
print = 1;
}
case short:
print = 0;
MP = MP.waiting;
}