Skip to content

Instantly share code, notes, and snippets.

@keyle
Created August 6, 2014 12:55
Show Gist options
  • Select an option

  • Save keyle/57cc8c9ae2e757b07019 to your computer and use it in GitHub Desktop.

Select an option

Save keyle/57cc8c9ae2e757b07019 to your computer and use it in GitHub Desktop.
def WITHIN_TRADE_PERIOD = minuteFromStart > 5 && minuteFromStart < 15
def RANGE_IS_SUDDEN = G.RANGE_NOW > 25 && G.RANGE_MIN1 < 15 && G.RANGE_MIN1 < 15
def PRICE_IS_GOING = price > 70 || price < 30
if (WITHIN_TRADE_PERIOD) {
println "potential trade..."
if (RANGE_IS_SUDDEN) {
println "Range is sudden!"
if (PRICE_IS_GOING) {
println "price is headed somewhere!"
if (G.CURRENTLY_TRADING) {
println "[nope] ALREADY IN MARKET!"
return;
}
if (price < 30) {
println "SELLING!"
new Buyz(instrument, (float) (data.b - 0.2), false)
G.CURRENTLY_TRADING = true
}
if (price > 70) {
println "BUYING!"
new Buyz(instrument, (float) (data.a + 0.2), true)
G.CURRENTLY_TRADING = true
}
} else {
println "[nope] price is indecisive..."
}
} else {
println "[nope] range is boring..."
}
} else {
println "[nope] trade outside of window :/"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment