Two strategy orders, one chart  [SOLVED]

Questions about MultiCharts and user contributed studies.
StefanoSF
Posts: 116
Joined: 19 Aug 2012
Location: San Francisco
Has thanked: 23 times
Been thanked: 30 times
Contact:

Two strategy orders, one chart

Postby StefanoSF » 06 Feb 2014

I have a strategy which uses "Position Limits" and "Allows up to 2 entry orders in the same direction".

The strategy was live with two separate contracts bought at different entry prices. Each contract has its own unique Profit Target based on entry.

Auto trading had to be turned off. Now when I Turn Auto Trading SA mode back on, I can only enter the "Avg Entry Price" for both positions.

How do I get each position back on the chart so that it matches my strategy and also regenerates each Take Profit order.

Do I use use SA Mode with !From Broker To Strategy MP Synchronizer!?

I read this:
https://www.multicharts.com/trading-sof ... _Selection

and this
https://www.multicharts.com/trading-sof ... Instrument

- S

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Two strategy orders, one chart

Postby Andrew MultiCharts » 06 Feb 2014

Hello StefanoSF,
I have a strategy which uses "Position Limits" and "Allows up to 2 entry orders in the same direction".

The strategy was live with two separate contracts bought at different entry prices. Each contract has its own unique Profit Target based on entry.
...
How do I get each position back on the chart so that it matches my strategy and also regenerates each Take Profit order.
Could you provide me with all lines generating the profit target from your code?
Auto trading had to be turned off. Now when I Turn Auto Trading SA mode back on, I can only enter the "Avg Entry Price" for both positions.
Even if you use multiple entries and multiple exits, the software works with entry price, not with each entry price.
Do I use use SA Mode with !From Broker To Strategy MP Synchronizer!?

I read this:
https://www.multicharts.com/trading-sof ... _Selection

and this
https://www.multicharts.com/trading-sof ... Instrument
If you trade only from 1 chart there is no need to do this. The article explains what should be taken into account and what can be done if you trade from more then 1 chart. Do you trade from multiple charts?

StefanoSF
Posts: 116
Joined: 19 Aug 2012
Location: San Francisco
Has thanked: 23 times
Been thanked: 30 times
Contact:

Re: Two strategy orders, one chart

Postby StefanoSF » 06 Feb 2014

Do you trade from multiple charts?
I autotrade one instrument, one chart, multiple entries and exits.
Could you provide me with all lines generating the profit target from your code?
This strategy uses ProfitTargetPct as primary exit and "Exit RSI and MA" as secondary.

Code: Select all

{ Exit RSI and MA }
If ( ExitFlag ) Then sell ("RSI LX") next bar open;
If ( MarketPosition <> 0 ) And EmergancyCross and StopLossPct > 0 Then
SetStopLoss( Close * StopLossPct ) ;


{ Exit TP and SL }
SetStopShare ;
if Marketposition <> 0 then
begin
if ProfitTargetAmt > 0 then
SetProfitTarget( ProfitTargetAmt ) ;
if StopLossAmt > 0 then
SetStopLoss( StopLossAmt ) ;
if ProfitTargetPct > 0 then
SetProfitTarget( EntryPrice * ProfitTargetPct ) ;
{if StopLossPct > 0 then
SetStopLoss( EntryPrice * StopLossPct ) ;}
end
else
begin
if ProfitTargetPct > 0 then
SetProfitTarget( Close * ProfitTargetPct ) ;
{if StopLossPct > 0 then
SetStopLoss( Close * StopLossPct ) ;}
end ;
Even if you use multiple entries and multiple exits, the software works with entry price, not with each entry price.
To clarify. If I have a two entry system (buy 1 contract at $10 and by 1 contract at $20) and I turn Autotrading off. When I restart Autotrading my only options is tell MC that I have 2 contracts with an Avg Entry Price of $15. My broker (IB) has two open contracts with different entry prices ($10 and $20). How can I get the actual entry prices to display correctly in my MC chart and have my exit Profit Targets based of of them?

StefanoSF
Posts: 116
Joined: 19 Aug 2012
Location: San Francisco
Has thanked: 23 times
Been thanked: 30 times
Contact:

Re: Two strategy orders, one chart

Postby StefanoSF » 06 Feb 2014

Is switching to Asynchronous Mode (AA) the solution for restarting an Auto trading strategy which already has multiple positions open? This also involves selecting "Assume the initial market position at the broker is the SAME AS on the Chart"

This does seems to work but not 100% sure.

https://www.multicharts.com/trading-sof ... _Execution

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Two strategy orders, one chart  [SOLVED]

Postby Andrew MultiCharts » 07 Feb 2014

StefanoSF,

I discussed the case with our developers in details and here is what i found out:
  • In current version of MC with the code you have you cannot reach your goal.
  • Theoretically it is possible to do what you want if you have different code (using regular limit and stop orders instead of the special ones), somehow you would be able to tell your code the number of executed opened entry orders before you switched the auto-trading off and back on and of course using the Assign Market Position feature on restart of auto-trading. But to tell the truth, such solution would be very complex and awkward. Other words: i do not recommend it.
  • What i do recommend is to wait for MC 9.0 (sorry no ETA at the moment), where the required tools will be available with an example code how to use them and you will be able to reach your goal.


Return to “MultiCharts”