Signal help Please

Questions about MultiCharts and user contributed studies.
miltonc4
Posts: 150
Joined: 14 Apr 2006
Has thanked: 1 time
Been thanked: 4 times

Signal help Please

Postby miltonc4 » 26 Feb 2008

Could someone help with this:-

Need to enter on close> EntryMA,and exit on close < ExitMA and entry and exits must only occur between EntryTime and ExitTime.
This signal takes the long trades only.
Once it works,I can modify to run a short signal as preference is to have a long signal in one chart and a short signal in another chart initially
Appreciate the help
Milton




[inputs:
{Long trades only in this signal}
Price( Close ),
Length( 9 ) ,
EntryMA (27),
ExitMA (9),
EntryTime(>=949 and <=430),//Entries can only occur in the day session.
ExitTime(>=949 and <=2300);//Late day entries,can exit in the night session.


variables:
EntryMA = AverageFC( Price,Length);
ExitMA = AverageFC( Price, Length) ;


if Price close above EntryMA
and time = EntryTime
then
Buy ( "EntryMA" ) next bar at market ;

if CurrentBar > 1 and Price close under ExitMA
and time >= ExitTime
then
Sell ( "ExitMA" ) next bar at market ;

{ ** Copyright (c) 1991-2003 TS Technologies, Inc. All rights reserved. **
** TS reserves the right to modify or overwrite this strategy component
with each release. ** }
][/code]

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 29 Feb 2008

Here is a correct script.

inputs:
{Long trades only in this signal}
Price( Close ),
Length( 9 ) ,
EntryTimeBeginInterval(0949),//Entries can only occur in the day session.
EntryTimeEndInterval(1630),
ExitTimeBeginInterval(0949),//Late day entries ,can exit in the night session.
ExitTimeEndInterval(2300);

variables: EntryMA(0), ExitMA(0);

EntryMA = AverageFC( Price,Length);
ExitMA = AverageFC( Price, Length) ;


if Price crosses above EntryMA and
(time >= EntryTimeBeginInterval and time <= EntryTimeEndInterval)
then
Buy ( "EntryMA" ) next bar at market ;

if CurrentBar > 1 and Price crosses under ExitMA and
(time >= ExitTimeBeginInterval and time <= ExitTimeEndInterval)
then
Sell ( "ExitMA" ) next bar at market ;

miltonc4
Posts: 150
Joined: 14 Apr 2006
Has thanked: 1 time
Been thanked: 4 times

Postby miltonc4 » 03 Mar 2008

Hello Andrew
Thanks for your help
Really appreciate it,works well
Regards
Millton

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 04 Mar 2008

You are welcome!


Return to “MultiCharts”