3309 Drysdale Ct
Edwardsville, IL 62025
Here's the complete code for a Long only strategy:
inputs: Price( Close ), Length( 8 ), ConfirmBars( 1 );
variables: var0( 0 ), var1( 0 ), x(0);
x = initialcapital+netprofit;
setprofittarget (x * 0.15);
setstoploss (x * 0.06);
value1 = Average( Price, Length )of data2;
condition1 = Price of data2 crosses above value1;
condition2 = Price of data2 crosses below value1;
if condition1 then
var0 = var0 + 1
else
var0 = 0 ;
if condition2 then
var1 = var1 + 1
var1 = 0 ;
condition1 = CurrentBar > ConfirmBars and var0 = ConfirmBars ;
condition2 = CurrentBar > ConfirmBars and var1 = ConfirmBars ;
Buy ( "MACrossLE" ) x/close contracts this bar;
Sell("Complete Exit") x/close contracts this bar;
Subscribe to our email list for regular free market updates as well as a chance to get coupons!
Title: code Here's the complete code
Long only on Multicharts
Posted by ascr on 8th of Nov 2010 at 10:39 am
Here's the complete code for a Long only strategy:
inputs: Price( Close ), Length( 8 ), ConfirmBars( 1 );
variables: var0( 0 ), var1( 0 ), x(0);
x = initialcapital+netprofit;
setprofittarget (x * 0.15);
setstoploss (x * 0.06);
value1 = Average( Price, Length )of data2;
condition1 = Price of data2 crosses above value1;
condition2 = Price of data2 crosses below value1;
if condition1 then
var0 = var0 + 1
else
var0 = 0 ;
if condition2 then
var1 = var1 + 1
else
var1 = 0 ;
condition1 = CurrentBar > ConfirmBars and var0 = ConfirmBars ;
condition2 = CurrentBar > ConfirmBars and var1 = ConfirmBars ;
if condition1 then
Buy ( "MACrossLE" ) x/close contracts this bar;
if condition2 then
Sell("Complete Exit") x/close contracts this bar;