SetStopLoss & ProfitTarget not working in simulation tra

Questions about MultiCharts and user contributed studies.
cyberdad
Posts: 36
Joined: 10 Aug 2009

SetStopLoss & ProfitTarget not working in simulation tra

Postby cyberdad » 15 Dec 2009

I made pseudo strategy just to watch the way setstoploss and setprofittarget work.
I used one of my IB paper-trading accounts to work with.
But whenever the strategy enters a trade I see no stop loss orders or profit target orders being transmitted.
Could this be because of the paper-trading account (simulated trading)?

This is the pseudo strategy I am using on EURUSD 2min data:

Code: Select all

if C > O and C[1] < O[1] and C[2] < O[2] then
begin
   if marketposition(0) = 0 then Buy next bar market;
   if marketposition(0) = -1 then Buytocover next bar market;
end;

if C < O and C[1] > O[1] and C[2] > O[2] then
begin
   if marketposition(0) = 0 then sellshort next bar market;
   if marketposition(0) = 1 then sell next bar market;
end;

SetStopPosition;
setstoploss(50);
setprofittarget(50);


I use it in synch mode. And the native OCO group option in IB Plugin properties is unchecked (tried this checked too - no difference).
Also the paper-trading account I am using is within a Financial Advisor account. But this shouldn't be a problem since it does enter and exit trades. The problem is that no stop loss or profit target orders are transmitted.

One last thing, in order to make MC work with my FA account I downloaded and replaced the old "TWSTradingPlugin.dll" with the new one.

brodnicki steven
Posts: 407
Joined: 01 Jan 2008
Been thanked: 3 times

Postby brodnicki steven » 15 Dec 2009

You are using it on Euro so it's 4 decimals. Try this

setstoploss(.0050);
setprofittarget(.0050);

.0050 = 50 pips.

cyberdad
Posts: 36
Joined: 10 Aug 2009

Postby cyberdad » 15 Dec 2009

You are using it on Euro so it's 4 decimals. Try this

setstoploss(.0050);
setprofittarget(.0050);

.0050 = 50 pips.


Setstoploss needs an amount of $ in its input, not an amount of pips.
My pseudo code should work as is.

Could anybody using an FA account to autotrade forex put me on the right track here? Or is this just a bug having to do with using a papertrading FA account?

cyberdad
Posts: 36
Joined: 10 Aug 2009

Postby cyberdad » 16 Dec 2009

I tried some of the built in strategies, this time with a real personal account (instead of an FA sim account) and still did not get any stop loss orders. Only entry orders are generated.
Not even that, the program crashed 4-5 times.
Something must be terribly wrong.
The only thing that worked in the real account, that is not working in the paper account is the marketposition. Does that mean that I can't trade a paper trading account with MC? That would really really bad.

Anyway, could someone PLEASE post the simplest strategy that is known to work with IB and that uses setstoploss and setprofittarget?

cyberdad
Posts: 36
Joined: 10 Aug 2009

Postby cyberdad » 16 Dec 2009

I installed the new version 6.0 beta 1 and at last i can see the stop loss orders generated in TWS.
I suspect that there was a connection between the various built in functions that place orders and the kind of marketposition function.
Since in version 5.5 there is a choice for synch and asynch mode this was most probably rising problems because the marketposition was not captured correctly in Multi from the broker.
I dont have the time to look deeper into it. I ll just go with version 6.0 and hope no new problems appear.

User avatar
pivot
Posts: 29
Joined: 07 Dec 2009
Been thanked: 2 times

Postby pivot » 17 Dec 2009

I second all the above I have been testing AT in MC and just recently added the FA patch/upgrade and I don't get and stop loss orders or Profit Target orders to be created in the Sim Account. Before this I did and it worked perfectly after 2 days of figuring out how to configure a FA. The short is that it worked before upgrade perfectly after upgrade it doesn't WORK. :cry:

tried:
1 AA
2 SA

and many combinations with OCO with/ w/o - multiple orders , etc etc etc. its not working!

PS it worked perfectly before!
PPS haven't upgraded yet.

User avatar
pivot
Posts: 29
Joined: 07 Dec 2009
Been thanked: 2 times

Postby pivot » 17 Dec 2009

Just Upgraded one of my machines and stops and targets working in MC6. :lol:


Return to “MultiCharts”