combining two signals

Questions about MultiCharts and user contributed studies.
tozwp
Posts: 145
Joined: 15 Apr 2011
Has thanked: 16 times
Been thanked: 8 times

combining two signals

Postby tozwp » 14 Dec 2020

Wondering if someone could point me in the right direction. I have two signals that I'd like to trade on one chart. One is long and the other is short. The entire system, 2 signals, is either long or short. The problem I'm having is that when the system is in one trade, say long, the other system is still calculating entries, stops and targets. When using setstoploss, setbreakeven and setprofittarget, these values cause the system with the active trade to often close out before a trade is taken from the other signal in the opposite direction. I do want valid signals in the opposite direction to close out the other trade but I can't figure out how to make the other trade not 'see' the in process values of the trade setting up. The most logical way that I can think of to keep this from happening would be for the signal that is active to only calculate stops and targets immediately after the trade is taken. System runs on minute data, end of bar so a buy signal would be taken sometime in the next bar after conditions were met on the previous bar. What I think would work would be some way to identify intra-bar exactly when the trade was taken and then create the stops and target values. I thought maybe using marketposition would work. I tried creating a variable MP = marketposition and declaring it intrabarpersist. I then checked MP[1] <> 0 and MP = 1 for a long entry during the next bar but this didn't seem to work. My logic, probably flawed, was that the trade was put on over the last tick and then I could calculate the stop and target value as inputs into the setstoploss, setbreakeven and setprofittarget. This just resulted in the trade being opened and closed immediately. Out of ideas and hoping someone can show me where to look next. Thanks!

User avatar
Vlada MultiCharts
Posts: 293
Joined: 22 Apr 2020
Has thanked: 8 times
Been thanked: 76 times

Re: combining two signals

Postby Vlada MultiCharts » 05 Mar 2021

Hello tozwp,

We can recommend using setstopcontract for special orders (setstoploss, setbreakeven and setprofittarget) and unconditional reversals.

If this does not resolve the issue, please send the following files to support@multicharts.com:
1. A simplified script;
2. A workspace with one chart in Exchange time on which the issue is reproduced;
3. Exported instrument data in QMD;
4. The description of the steps we should follow to reproduce the issue on our end.


Return to “MultiCharts”