SetStopLoss and SetProfitTarget weirdness.

Questions about MultiCharts and user contributed studies.
felixtjung
Posts: 24
Joined: 06 Apr 2011
Has thanked: 5 times
Been thanked: 2 times

SetStopLoss and SetProfitTarget weirdness.

Postby felixtjung » 15 Apr 2011

Hi,

I'm having a trouble using SetStopLoss() and SetProfitTarget() on forex market.

I'm still newbie when comes to multicharts. So, sorry for my n00bish question.

My setting is:

Code: Select all

Multichart Version 6.1 Release (Build 3605)
Broker: Open E-Cry
Symbol: AUD/USD
Price Scale: 1/100000
Daily Limit: 1
Min Move: 1
BigPointValue: 1
The debug code that I'm using is:

Code: Select all

If marketposition = 0 then
begin
Buy("TEntry") 1 contract This Bar On Close;
end;

setstopposition;
setprofittarget(300);
setstoploss(300);

messagelog("PriceScale is ", PriceScale:10:10);
messagelog("BigPointValue is ", bigpointvalue:10:10);
messagelog("PointValue is ", PointValue:10:10);
I would expect multicharts to set stop loss such that when that stop loss is hit, my entire loss for that position is $300.

But when I run it, it tries to set the stop to something ridiculous...

For example,

When order "Buy 1 contract@1.05259" is filled, multicharts will try to set profit target as with price $301.05259.


I put the debug log and it print out following output:

Code: Select all

PriceScale is 100000.0000000000
BigPointValue is 1.0000000000
PointValue is 0.0000100000
Is there anyway to fix this problem?

Thanks,
Felix

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 302 times

Re: SetStopLoss and SetProfitTarget weirdness.

Postby Stan Bokov » 15 Apr 2011

Hi Felix,

Your code seems alright - if you read the help for setstoploss and setprofittarget, you specified to close out your position when your total profit or loss reaches $300. You purchase one contract for roughly $1, so it must go up to $300 for you to have a 300 dollar profit. If you buy 10, or 100, or 1000 contracts, you will be able to hit the loss and profit amounts much quicker, so the levels will be set closer to your entry price.

felixtjung
Posts: 24
Joined: 06 Apr 2011
Has thanked: 5 times
Been thanked: 2 times

Re: SetStopLoss and SetProfitTarget weirdness.

Postby felixtjung » 15 Apr 2011

I think I misunderstand the configuration about BigPointValue and PriceScale. I read the help file about that and set BigPointValue=100000 as it should be. Now it works.


Thanks

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 302 times

Re: SetStopLoss and SetProfitTarget weirdness.

Postby Stan Bokov » 18 Apr 2011

Glad I could help.


Return to “MultiCharts”