Assign Initial Market Position Entry Names  [SOLVED]

Questions about MultiCharts and user contributed studies.
Parker
Posts: 22
Joined: 18 May 2018
Has thanked: 7 times

Assign Initial Market Position Entry Names

Postby Parker » 24 Jun 2018

Hi,

I have an issue with using the "assign initial market position" after there has been a loss of connection and MC is restarted. After there has been a connection loss I want to leave trades open and MC pick up managing them where it left off once everything is reconnected. The problem is I manage trades by referring to entry names in my code. For example an exit rule would be "if MP=1 and rule1=true then Sell ("LX") from Entry ("LE") next bar at Open". Where "LX" is the name of the entry I want it to close. The "assign initial market position" dialog box allows to specify the positions direction, number of contracts and entry price, but not the name of the Entry it refers to. MC names them all as "Initial Entry". This means the exit logic never triggers. How do people deal with this in their strategies? Is there an option to set the Entry names that I am missing? Or is the only option not to refer to Entry names in the Exit logic in my codes?

Thanks.

User avatar
Smoky
Posts: 517
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 99 times
Been thanked: 121 times

Re: Assign Initial Market Position Entry Names  [SOLVED]

Postby Smoky » 24 Jun 2018

Make a backup of yours orders names ex: lastBuyOrder=OrderName / Last SellOrder=OrderName;

when your logic find a name like "Initial Entry" replace this name by your backup name...

You can save this name in registry to use it after a new MC start or a PC reboot for exemple...

https://fx1.net/permvar.php

Parker
Posts: 22
Joined: 18 May 2018
Has thanked: 7 times

Re: Assign Initial Market Position Entry Names

Postby Parker » 27 Jun 2018

This was a great idea!

I have managed to do this using csv files, a separate function and Global Variables. I use one function to save entry names, times, contracts, etc, to a csv file every time the position changes. Then whenever I restart auto trading I call another function in my signals that check for a position at the broker and an entry name of "Initial Entry", if these are there the signal pulls the data through and uses it in the exit logic.

Thanks.

User avatar
Smoky
Posts: 517
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 99 times
Been thanked: 121 times

Re: Assign Initial Market Position Entry Names

Postby Smoky » 28 Jun 2018

Thank You, i prefer using this tool, because you have direct accces to you datas records, not like sequencial reading of CSV file.

Your backup datas can be read in multithread by many stategy in same time without any problem.


Return to “MultiCharts”