Last active
June 12, 2020 22:03
-
-
Save lvca/c1efb5c5fa5196d00285c6b908b4dc4b to your computer and use it in GitHub Desktop.
Arcade Trader strategy to invest when the sma50 line crosses over the sma200 line and sell when the sma50 crosses below sma200 line
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
function beginTrading(context){ | |
if( History.days().length > 1 ) { | |
let yesterday = History.last(); | |
let prev = History.relative(-1); | |
if( yesterday.wma150 >= yesterday.wma200 && | |
prev.wma150 < prev.wma200 ) | |
return { invest: true, reason: "wma-150 crossed over wma-200" }; | |
} | |
} | |
function endTrading(context){ | |
let yesterday = History.last(); | |
let prev = History.relative(-1); | |
if( yesterday.wma150 < yesterday.wma200 && | |
prev.wma150 >= prev.wma200 ) | |
return { reason: "wma-150 crossed below wma-200" } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment