Apologies for my beginner question. I have a very simple moving average strategy
Code: Select all
inputs: Price( Close ), FastLength( 5 ), SlowLength( 10 ) ;
variables: var0( 0 ), var1( 0 ) ;
var0 = AverageFC( Price, FastLength ) ;
var1 = AverageFC( Price, SlowLength ) ;
condition1 = CurrentBar > 1 and var0 crosses over var1 ;
condition2 = CurrentBar > 1 and var1 crosses over var0 ;
if condition1 then
Buy ( "Go long" ) next bar 10 contract at market ;
if condition2 then
Sell ( "Long exit" ) next bar 10 contract at market ;
Would I do something like this?
Code: Select all
spreadcondition = DOM_AskPrice(1)- DOM_BidPrice(1) < 0.0001 #only go long when spread is below a pip
if condition1 and spreadcondition then
Buy ( "Go long" ) next bar 10 contract at market ;
Thanks!