Get exist position info when re-active auto-trading

Questions about MultiCharts and user contributed studies.
yoyo2000
Posts: 26
Joined: 07 Nov 2012

Get exist position info when re-active auto-trading

Postby yoyo2000 » 07 Nov 2012

Hi,I'm learning MC and EL these days,but don't know how to code the case below:

1. having active auto-trading and made 3 trades,one for base position with signal name "LE" (buy at 3754,position size is 5 contracts),2 pyramiding trades with names "Pyrmd1"(buy at 3772, size is 2 contracts), and "Pyrmd2"(buy at 3780,size is 1 contract).

2. for some reasons,turn the auto-trading mode off.

3. turn mc7's auto-trading mode on again.now how to get the position infomation in step 1. ?

I heard that only average entry price could be set,and none of others could be get in MC7,is it?

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

Re: Get exist position info when re-active auto-trading

Postby Andrew MultiCharts » 07 Nov 2012

Hello yoyo2000,

1. Order placement logic should be scripted in your signal. As for pyramiding, it can be enabled here.
2. It is not possible to turn on/off automation right from script. You can create a certain condition for the whole script to start/stop working, but automation should be switched on/off manually.
3. You can assign initial market position for strategy on a particular chart when you turn on automation.

yoyo2000
Posts: 26
Joined: 07 Nov 2012

Re: Get exist position info when re-active auto-trading

Postby yoyo2000 » 07 Nov 2012

thanks,Andrew.
maybe i didn't descript my problem clearly,I did mean switch on/off auto-trading manually,my initial operations are:
1. activate the strategy with the N.o 1 parameters group;
2. when market condition changes,I decide to trading with the N.o 2 parameters group,so I switch off the auto-trading mode,modify the parameters' value(or, I modify the parameters' value,auto-trading mode would be switch off by MC itself),and then switch on the auto-trading mode.
3. how to tell mc that there are 3 positions,one for base position and 2 for pyramid position

so it's semi auto-trading,and the parameters' value would be modified manually,and the difficulty is telling mc the infomation of price and size of previously position.(not average price and total size,but detailed price and size of each position)

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

Re: Get exist position info when re-active auto-trading

Postby Andrew MultiCharts » 07 Nov 2012

What are the conditions for switching between 3 sets of inputs for the strategy (i believe parameter = input)?

yoyo2000
Posts: 26
Joined: 07 Nov 2012

Re: Get exist position info when re-active auto-trading

Postby yoyo2000 » 07 Nov 2012

yes,parameters = inputs.

and the condition for changing parameters is very subjective.

for example,a strategy of spread trading for 3 commodities,sometime establishing positions when spread is 20 points,but sometime the 20 points spread is too narrow,i'd like to trading with 50 points spread.

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

Re: Get exist position info when re-active auto-trading

Postby Andrew MultiCharts » 13 Nov 2012

This feature should be helpful for you.
These users thanked the author Andrew MultiCharts for the post:
JoshM

yoyo2000
Posts: 26
Joined: 07 Nov 2012

Re: Get exist position info when re-active auto-trading

Postby yoyo2000 » 14 Nov 2012

thanks,with this option,only one entry price and total position size could be inputed,if exist position established with 2 or more pyramiding tradings,how to tell MC each position's entry price and entry size?

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

Re: Get exist position info when re-active auto-trading

Postby Andrew MultiCharts » 14 Nov 2012

MC works with 1 general (net) position always, not with multiple separate entries/positions.

yoyo2000
Posts: 26
Joined: 07 Nov 2012

Re: Get exist position info when re-active auto-trading

Postby yoyo2000 » 15 Nov 2012

so,any in-direct way to store and use multiple separate entries/positions data?for example,ELcollection

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

Re: Get exist position info when re-active auto-trading

Postby Andrew MultiCharts » 17 Nov 2012

In regular MultiCharts you cannot receive price of an executed order from order and Position Tracker window. You can only return Avg Entry Price (for net position), so you can write it down to a file as well as price each generated order to read (by means of a 3rd party .dll) and use this information from the file after turning automation off and on. Depending on the logic of your strategy you can use it for partial exits.

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Get exist position info when re-active auto-trading

Postby arjfca » 21 Nov 2012

yoyo2000 wrote:so,any in-direct way to store and use multiple separate entries/positions data?for example,ELcollection


You may try Global Variable or a text file

Code: Select all

Value1 = GVSetNamedString ("LastStopPrice",NumToStr(StopPrice,4)); // Set the value
BackupStopPrice = NumtoStr(GVGetNamedString("LastStopPrice","9999")); // Retreive the value

** Personal preference. I always save any number as a string

Martin
These users thanked the author arjfca for the post:
Andrew MultiCharts


Return to “MultiCharts”