SetProfitTarget, SetStopLoss & CurrentContracts

Questions about MultiCharts and user contributed studies.
duration
Posts: 175
Joined: 20 Dec 2005

SetProfitTarget, SetStopLoss & CurrentContracts

Postby duration » 26 Jan 2013

Code: Select all

Inputs:
   PROFITTARGET( 8 ),
   STOPLOSS( 10 );

SetProfitTarget( PROFITTARGET * 10 ) ;

SetStopLoss( STOPLOSS * 10) ;


The does what it is intended to do.

However, whenever I add CurrentContracts:

Code: Select all

Inputs:
   PROFITTARGET( 8 ),
   STOPLOSS( 10 );

SetProfitTarget( PROFITTARGET * 10 * CurrentContracts) ;

SetStopLoss( STOPLOSS * 10 * CurrentContracts) ;


Both SetProfitTarget and SetStopLoss seem to return a very low value and trades exit immediately (either in loss or in profit), with usually 1 pip.

The number of contracts traded is always one (but I plan to add more).

I do not understand why the values are not 80 and 100...

User avatar
TJ
Posts: 6572
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1902 times

Re: SetProfitTarget, SetStopLoss & CurrentContracts

Postby TJ » 26 Jan 2013

it is possible that CurrentContracts is not updated until the end of the bar.

duration
Posts: 175
Joined: 20 Dec 2005

Re: SetProfitTarget, SetStopLoss & CurrentContracts

Postby duration » 26 Jan 2013

Hi TJ,

Thanks a lot for your reply!

How would you go about scaling SetProfitTarget & SetStopLoss to the number of contracts traded?

Many thanks,

User avatar
TJ
Posts: 6572
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1902 times

Re: SetProfitTarget, SetStopLoss & CurrentContracts

Postby TJ » 26 Jan 2013

duration wrote:Hi TJ,

Thanks a lot for your reply!

How would you go about scaling SetProfitTarget & SetStopLoss to the number of contracts traded?

Many thanks,


Scaling in an autotrade is always tricky; There is no easy way, you need to do many cross checkings to make sure your numbers are correct and in sync.

How do you determine the number of contracts to trade? You can use that as a starting number. After the 1st bar, you can update it with the # of contracts filled.


Return to “MultiCharts”