PureBytes Links
Trading Reference Links
|
> Can anyone suggest changes to generate a signal that can be
> backtested and quantified?
>
> I tried adding buy and sell instead of the plot command, but not
> the right way to do it.
I'm not sure what you did, but I just changed your plot commands to
buy & sell and it worked fine.
BTW, you don't need to pass in the TickSize unless you want to use a
non-standard tick size. You can use "MinMove points" in your system,
and that will return the correct TickSize for the current symbol.
Also, if you want, you can use the MarketPosition variable like Kent
suggested, and get rid of the Mode variable entirely. See below.
Gary
Input: XTics(3), MA1Len(10), MA2Len(10);
Var: MA1(0), MA2(0), Mode(1);
MA1 = Average(L, MA1Len);
MA2 = Average(H, MA2Len);
If MarketPosition >= 0 and C < MA1 - XTics * Minmove points then sell;
If MarketPosition <= 0 and C > MA2 + XTics * Minmove points then buy;
|