close one trade per day for a same symbol
Author: abegy
Creation Date: 11/4/2012 10:54 AM
profile picture

abegy

#1
I have 3 strategies which generate several trades per day.
As each strategy is in separate script, I can have for a same symbol several trades for a day.
In this case, I would like to close only 1 trade and report the others to the next day.

How can I do that ?
profile picture

Eugene

#2
What does "report the others to the next day" mean?

At any rate, before coding or suggesting I would like to ask you to rephrase and clarify in greater detail so that everything is clear and unambiguous. tia.
profile picture

abegy

#3
Sorry, the right word was postpone instead of report.
I will try to explain what is my problem and what I would like to do.

I have 3 strategies which are working with same symbols.
Each strategy manages open/close trades independently from others strategies.

As some symbols have small volume by day, I would like to be sure that if I have several positions to close for the same symbol at the same day, I can close only one and postpone for the next day the others.
profile picture

Eugene

#4
Thanks for the clarification. So to rephrase, any other [from 0 to 2] strategies having an open position in the same stock should keep from closing it until the next day, if any strategy from that bulk have closed it? You can try storing this information somehow, for example, using SetGlobal/GetGlobal (or text file, or... whatever), but exactly will you determine what to do if two or all three systems have decided to close their own trades in that symbol on the same Daily bar? i.e. How to determine priority?
profile picture

abegy

#5
Yes, you are right. I have forgotten to speak about priority to close a trade. It will be managed by the current profit of the position. The worst position must be closed firstly.
Normally, for doing this, I need to study all alerts which want to close a position for a same symbol and take only one which the current profit is the worst and cancel the others.
In the script of each strategy, I need to put a code to generate again the alert the day after in case of the previous alert was cancelled.

How can I do that exactly ?
profile picture

Eugene

#6
By the time your strategy has Alerts, it's over. You should do it before that. And I don't see a way to reliably synchronize them if they are running simultaneously. So I think you need to run them all twice. One run is for the normal execution and to save the daily status based on the current profit (theoretical mode, "status" missing), and another run to read the "status" (which exists = live mode) and act accordingly. The actual implementation is up to you: from Wealth-Lab's global memory to text files to... Hope that helps.
profile picture

abegy

#7
thanks a lot !
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).