About SetStopxxx keywords

Questions about MultiCharts and user contributed studies.
User avatar
johnmok
Posts: 85
Joined: 18 Oct 2011
Has thanked: 30 times
Been thanked: 8 times

About SetStopxxx keywords

Postby johnmok » 27 Oct 2011

hi all, i am writing setstoploss and setprofittarget function, i want the setstoploss function to be position basis, and the setprofittarget function on a share basis, therefore i use the code as follows

Code: Select all

setstopposition;
setstoploss(50);
setstopshare;
setprofittarget(300);
but the result is that stoploss and profittarget both become share basis, any method to do the job in my way?

thanks :-)

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

Re: About SetStopxxx keywords

Postby TJ » 27 Oct 2011

hi all, i am writing setstoploss and setprofittarget function, i want the setstoploss function to be position basis, and the setprofittarget function on a share basis, therefore i use the code as follows

Code: Select all

setstopposition;
setstoploss(50);
setstopshare;
setprofittarget(300);
but the result is that stoploss and profittarget both become share basis, any method to do the job in my way?

thanks :-)
convert everything to $

User avatar
johnmok
Posts: 85
Joined: 18 Oct 2011
Has thanked: 30 times
Been thanked: 8 times

Re: About SetStopxxx keywords

Postby johnmok » 27 Oct 2011

hi TJ,

the value "50" and "300" is already means money, aiming at stop loss when have a loss of $50,

and take profit when the profit reach $300.

may you explain it in detail? thanks.

john

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

Re: About SetStopxxx keywords

Postby TJ » 27 Oct 2011

hi TJ,

the value "50" and "300" is already means money, aiming at stop loss when have a loss of $50,

and take profit when the profit reach $300.

may you explain it in detail? thanks.

john
I misunderstood what you mean.
No, I don't have a solution for that.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: About SetStopxxx keywords

Postby JoshM » 29 Oct 2011

the value "50" and "300" is already means money, aiming at stop loss when have a loss of $50,

and take profit when the profit reach $300.
Your code does something else then you're trying to achieve, if I understand you correctly:

Code: Select all

setstopposition;
setstoploss(50);
setstopshare;
setprofittarget(300);
This exits the whole position if the loss is $50, and exits if the profit per contract/share equals $300 (which is something different than take profit when the profit reaches $300).

See page 90 from the EasyLanguage Essentials guide (found here) for more about SetProfitTarget/SetStopLoss.

Regards,
Josh

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: About SetStopxxx keywords

Postby escamillo » 30 Oct 2011

Is this what you are trying to do?

Code: Select all

SetStopContract ;
SetStopLoss(50/CurrentContracts) ;
SetProfitTarget(300) ;


Return to “MultiCharts”