Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 10-25-2009, 04:24 AM   #1
aaa

aaa's Avatar

Join Date: Jun 2008
Location: Switzerland
Posts: 443
Ignore this user

Thanks: 240
Thanked 283 Times in 136 Posts

Strategy Question

Hello

I'm exploring backtesting but I am a real beginner in strategy

I can program a long or short entry with a stop

Now I try to add more contracts to a position

like this

// if c > entryprice + 50 point then
// Buy ( "Long2") 10 contracts this bar ;

or like that

// Buy ( "Long2") 10 contracts next bar at entryprice + 100 point stop ;


w/o success

All suggestion are welcome

Have a nice day

aaa

-----------------------------------------------------------------------------------

Here is a long entry example

{---------------- Long Side ----------------}


if marketposition <> 1 then

if c > AverageFC( c, 10 ) then
Buy ( "LongEntry" ) 100 contracts this bar ;

if marketposition = 1 then
begin

if c < AverageFC( c, 50 ) then
Sell ( "LongStop" ) this bar ;

Sell ("LongExit") next Bar at LowestFC(low, 10) + 0 point stop ;

end;
aaa is offline  
Reply With Quote
Old 10-25-2009, 05:15 AM   #2

Join Date: May 2008
Location: London
Posts: 44
Ignore this user

Thanks: 26
Thanked 21 Times in 15 Posts

Re: Strategy Question

Silly question - did you leave the // at the beginning of the relevant lines of codes, because that just makes them into comments ?

Charlton
Charlton is offline  
Reply With Quote
Old 10-25-2009, 05:57 AM   #3
aaa

aaa's Avatar

Join Date: Jun 2008
Location: Switzerland
Posts: 443
Ignore this user

Thanks: 240
Thanked 283 Times in 136 Posts

Re: Strategy Question

Quote:
Now I try to add more contracts to a position

like this

// if c > entryprice + 50 point then
// Buy ( "Long2") 10 contracts this bar ;

or like that

// Buy ( "Long2") 10 contracts next bar at entryprice + 100 point stop ;


without success
Hello Charlton

ThanX for your gentle help

// means that the code after doesn't work

// or to give information

// so we don't have to take them off

It could also be this way

{
Example 1
if c > entryprice + 50 point then
Buy ( "Long2") 10 contracts this bar ;

Example 2
Buy ( "Long2") 10 contracts next bar at entryprice + 100 point stop ;
}

---------------------------------------------

My question is

Is this code the way to add more contracts ?

If not

Can you suggest me an other way ?
aaa is offline  
Reply With Quote
Old 10-25-2009, 12:52 PM   #4

Join Date: Nov 2006
Location: N/A
Posts: 612
Ignore this user

Thanks: 62
Thanked 294 Times in 177 Posts

Re: Strategy Question

Quote:
Originally Posted by aaa »
Hello Charlton

ThanX for your gentle help

// means that the code after doesn't work

// or to give information

// so we don't have to take them off

It could also be this way

{
Example 1
if c > entryprice + 50 point then
Buy ( "Long2") 10 contracts this bar ;

Example 2
Buy ( "Long2") 10 contracts next bar at entryprice + 100 point stop ;
}

---------------------------------------------

My question is

Is this code the way to add more contracts ?

If not

Can you suggest me an other way ?
When you say it doesn't work, does it not buy anything? What if you change it to 1 contract? Does it buy it then?

I am still using TS 2000i and I know you can set the maximum number of contracts and if pyramiding is allowed for the the strategy under the strategy properties in "Format Strategy". Maybe it is the same in the newer versions of TS. The default maximum number of contracts is 1 and pyramiding not allowed. So if yours are still default settings, this might explain why it is not working.
sevensa is offline  
Reply With Quote
The Following User Says Thank You to sevensa For This Useful Post:
aaa (10-25-2009)
Old 10-25-2009, 01:25 PM   #5
aaa

aaa's Avatar

Join Date: Jun 2008
Location: Switzerland
Posts: 443
Ignore this user

Thanks: 240
Thanked 283 Times in 136 Posts

Re: Strategy Question

Hello Sevensa

You are always helpfull with the others and your advices are very good

I'm confused because I open oftenly strategy properties and I 've never seen the Position Limits

So I allowed up to x entry orders in the same direction and it works fine.

Also this is important to put in the beginning of the script

[IntrabarOrderGeneration = false]

Have a nice evening

aaa
aaa is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tradestation Strategy Question trbates Automated Trading 12 10-27-2010 11:07 AM
Help with My First Strategy ptcman Coding Forum 25 10-08-2009 07:53 AM
Strategy for Es TWI Automated Trading 6 10-28-2008 02:18 PM
Simple fib Strategy feb2865 Technical Analysis 1 09-19-2007 06:59 PM
ER2 Trading Strategy Question Soultrader E-mini Futures Trading Laboratory 24 02-25-2007 08:33 PM

All times are GMT -4. The time now is 02:03 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.