Created
April 18, 2023 15:25
-
-
Save iCodeForBananas/caae438f0da6165b26350c46cbee7a91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Inputs: | |
TradeSize(1), | |
EmaLength(30), | |
StopSize(10); | |
Variables: | |
Ema(0), | |
PriorBarHigh(0), | |
PriorBarLow(0); | |
Ema = XAverage(Close, EmaLength); | |
If CrossesAbove(Close, Ema) Then | |
Begin | |
PriorBarLow = Low[1]; | |
Buy ("Long") TradeSize Shares Next Bar at Market; | |
Sell ("LongStop") TradeSize Shares Next Bar at PriorBarLow - StopSize Stop; | |
End; | |
If CrossesBelow(Close, Ema) Then | |
Begin | |
PriorBarHigh = High[1]; | |
SellShort ("Short") TradeSize Shares Next Bar at Market; | |
BuyToCover ("ShortStop") TradeSize Shares Next Bar at PriorBarHigh + StopSize Stop; | |
End; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment