Help creating script line.in seetu

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 )

image

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);

image