Hey Chris, I've never delved into Forex trading but it looks like this is just a basic limit buy order followed by a limit sell order. A very crude implementation on Quantopian with regular stocks would be something like this:
def initialize(context):
context.limit_active = False
context.stock = sid(14848)
context.limit_buy = 15.05
context.limit_sell = 15.30
context.num_shares = 1000
def handle_data(context, data):
current_price = data[context.stock].price
if not context.limit_active and current_price <= context.limit_buy:
order(context.stock, context.num_shares)
log.info("%s shares of Yahoo bought" % context.num_shares)
context.limit_active = True
if context.limit_active and current_price >= context.limit_sell:
order(context.stock, -context.num_shares)
log.info("%s shares of Yahoo sold" % -context.num_shares)
context.limit_active = False
This just orders some shares when the price drops below a certain price and then resells them once it rises above a different price.