simple t.s. example

Questions about MultiCharts and user contributed studies.
davide007
Posts: 6
Joined: 01 Feb 2013
Has thanked: 2 times

simple t.s. example

Postby davide007 » 11 Feb 2013

Hi,
I'm Italian, my english in not good. Sorry.
i'm testing MC ( free 30 days ).
I'd like to test the function backtest ok trading system.
Where can i find a script of a simple trading system ?
Thanks
Davide

davide007
Posts: 6
Joined: 01 Feb 2013
Has thanked: 2 times

Re: simple t.s. example

Postby davide007 » 11 Feb 2013

this is a default MC script :
____________________________________________
inputs: Price( Close ), FastLength( 9 ), SlowLength( 18 ) ;
variables: var0( 0 ), var1( 0 ) ;

var0 = AverageFC( Price, FastLength ) ;
var1 = AverageFC( Price, SlowLength ) ;

condition1 = CurrentBar > 1 and var0 crosses over var1 ;
if condition1 then
Buy ( "MA2CrossLE" ) next bar at market ;
____________________________________________

Can you help me tu write an exit ?
Thanks

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: simple t.s. example

Postby sptrader » 11 Feb 2013

You need to open the power language editor, then select "file", then " open", then select "signals", that's where the systems are located...
(In charting the power editor is the Fx icon at the top of the page.) there is also an icon on your desktop..

davide007
Posts: 6
Joined: 01 Feb 2013
Has thanked: 2 times

Re: simple t.s. example

Postby davide007 » 11 Feb 2013

You need to open the power language editor, then select "file", then " open", then select "signals", that's where the systems are located...
(In charting the power editor is the Fx icon at the top of the page.) there is also an icon on your desktop..
thanks.
I found some default t.s. but are not ready to run.
For exemple this
_____________________________________
inputs: Price( Close ), FastLength( 9 ), SlowLength( 18 ) ;
variables: var0( 0 ), var1( 0 ) ;

var0 = AverageFC( Price, FastLength ) ;
var1 = AverageFC( Price, SlowLength ) ;

condition1 = CurrentBar > 1 and var0 crosses over var1 ;
if condition1 then
Buy ( "MA2CrossLE" ) next bar at market ;
_____________________________________

What can i write to complete this system ?
Thanks
Davide

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: simple t.s. example

Postby TJ » 11 Feb 2013

this is a default MC script :
____________________________________________
inputs: Price( Close ), FastLength( 9 ), SlowLength( 18 ) ;
variables: var0( 0 ), var1( 0 ) ;

var0 = AverageFC( Price, FastLength ) ;
var1 = AverageFC( Price, SlowLength ) ;

condition1 = CurrentBar > 1 and var0 crosses over var1 ;
if condition1 then
Buy ( "MA2CrossLE" ) next bar at market ;
____________________________________________

Can you help me tu write an exit ?
Thanks
go back to where you found the above code,
then look for the next strategy name "MovingAverage2line Cross SE".

davide007
Posts: 6
Joined: 01 Feb 2013
Has thanked: 2 times

Re: simple t.s. example

Postby davide007 » 12 Feb 2013

Thanks.
I typed this script mixing the two t.s.
________________________________________________

inputs: Price( Close ), FastLength( 9 ), SlowLength( 18 ) ;
variables: var0( 0 ), var1( 0 ) ;

var0 = AverageFC( Price, FastLength ) ;
var1 = AverageFC( Price, SlowLength ) ;

condition1 = CurrentBar > 1 and var0 crosses over var1 ;
if condition1 then
Buy ( "MA2CrossLE" ) next bar at market ;

condition2 = CurrentBar > 1 and var0 crosses under var1 ;
if condition2 then
Sell Short ( "MA2CrossSE" ) next bar at market ;
_________________________________________________

Is it correct ?
Thanks

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: simple t.s. example

Postby Henry MultiСharts » 12 Feb 2013

Hello davide007,

If you have tried to combine MovAvg2Line Cross LE and MovAvg2Line Cross SE into a single code reverse strategy then the code is correct.

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: simple t.s. example

Postby TJ » 12 Feb 2013

Thanks.
I typed this script mixing the two t.s.
________________________________________________

inputs: Price( Close ), FastLength( 9 ), SlowLength( 18 ) ;
variables: var0( 0 ), var1( 0 ) ;

var0 = AverageFC( Price, FastLength ) ;
var1 = AverageFC( Price, SlowLength ) ;

condition1 = CurrentBar > 1 and var0 crosses over var1 ;
if condition1 then
Buy ( "MA2CrossLE" ) next bar at market ;

condition2 = CurrentBar > 1 and var0 crosses under var1 ;
if condition2 then
Sell Short ( "MA2CrossSE" ) next bar at market ;
_________________________________________________

Is it correct ?
Thanks
Give it a try, you can't damage anything. (just don't go live on real money account).

Another way to do it is to apply both strategies to your chart.



ps. Helpful FAQ for learning EasyLanguage:
viewtopic.php?f=16&t=6929

You will find EasyLanguage a powerful tool for the traders.


Return to “MultiCharts”