Buy = Cross( ShortMA, LongMA )
im trying to tell it to buy when short MA crosses under the LongMA
any help would be cool
The opinions expressed in these forums do not represent those of C2, and any discussion of profit/loss is not indicative of future performance or success. There is a substantial risk of loss in trading. You should therefore carefully consider whether such trading is suitable for you in light of your financial condition. You should read, understand, and consider the Risk Disclosure Statement that is provided by your broker before you consider trading. Most people who trade lose money.
Buy = Cross( ShortMA, LongMA )
im trying to tell it to buy when short MA crosses under the LongMA
any help would be cool
Hello!
Buy = Cross( ShortMA, LongMA )
buys when ShortMA crosses above LongMA.
To find out when ShortMA crosses below LongMA, just swap parameters:
Buy = Cross( LongMA, ShortMA )
SetOption("Symbols", "MSFT");
short = MA(Close,10);
long = MA(Close,30);
BuyShortLong = Cross(short, long);
BuyLongShort = Cross(long, short);
// Show BuyShortLong and BuyLongShort in Exploration
Filter = BuyShortLong OR BuyLongShort;
AppendColumn(BuyShortLong,"BuyShortLong");
AppendColumn(BuyLongShort,"BuyLongShort");
// Plot "short" and "long"
doPlot(short , "Short",colorRed);
doPlot(long, "Long", colorBlue);
// Simple crosses visualisation. Show $150 where crosses happen.
doPlot( IIF(BuyShortLong,150,0) , "BuyShortLong",colorGreen);
doPlot( IIF(BuyLongShort,150,0) , "BuyLongShort",colorBlack);