Hi guys, i've got a problem.
I've two systems applied to 1 chart:
System 1 : With Stop loss
System 2 : Without Stop loss
System 2 read the stop loss of System 1, going out from the market many times.
I think that it happens, because "SetStopLoss" function works if Marketposition <> 0.
Anyone have some ideas to solve this problem ?
Thank you very much in any case.
Cordially
No Erocla
SetStopLoss Confilct with two systems applied to one chart. [SOLVED]
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: SetStopLoss Confilct with two systems applied to one cha
1. I would use the KISS principle... combine the systems in one strategy.Hi guys, i've got a problem.
I've two systems applied to 1 chart:
System 1 : With Stop loss
System 2 : Without Stop loss
System 2 read the stop loss of System 1, going out from the market many times.
I think that it happens, because "SetStopLoss" function works if Marketposition <> 0.
Anyone have some ideas to solve this problem ?
Thank you very much in any case.
Cordially
No Erocla
2. Please start here: viewtopic.php?f=16&t=10811
Re: SetStopLoss Confilct with two systems applied to one cha
Thank you for answer,
i would like to solve this problem without rewriting my trading system portfolio, there s some other way to do it ? Or the only 1 way is to write all in 1 code ?
Thank you again for any answer.
No Erocla
i would like to solve this problem without rewriting my trading system portfolio, there s some other way to do it ? Or the only 1 way is to write all in 1 code ?
Thank you again for any answer.
No Erocla
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: SetStopLoss Confilct with two systems applied to one cha
Sorry... can't offer any specifics without studying the code; there are too many possibilities.Thank you for answer,
i would like to solve this problem without rewriting my trading system portfolio, there s some other way to do it ? Or the only 1 way is to write all in 1 code ?
Thank you again for any answer.
No Erocla
But I can repeat... use the KISS principle when it comes to dealing with money and complex systems. Because whatever you are doing right now, it is only the beginning, it will only get MORE complex with time. You will tweak your systems a thousand times between now and Christmas. If you do not have a good grip on what you are doing, I would stop and read my suggestion #2 above.
Re: SetStopLoss Confilct with two systems applied to one cha
Maybe i explains badly, my question can involve any pair of systems.
SetStopLoss works alwais if marketposition <> 0, so if you have two strategy active to one chart, stop loss (or profit target) will generate conflicts.
There's some easy way to solve this problem ?
For example i thought about put stop loss into long/short condition:
if (average(c,5)>average(c,10) then begin
buy 1 contract next bar on open;
setstoploss(100);
end;
But i found some bug doing it, stoploss does not works correctly.
Thank you again for your time.
Cordially
SetStopLoss works alwais if marketposition <> 0, so if you have two strategy active to one chart, stop loss (or profit target) will generate conflicts.
There's some easy way to solve this problem ?
For example i thought about put stop loss into long/short condition:
if (average(c,5)>average(c,10) then begin
buy 1 contract next bar on open;
setstoploss(100);
end;
But i found some bug doing it, stoploss does not works correctly.
Thank you again for your time.
Cordially
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: SetStopLoss Confilct with two systems applied to one cha
a bit related and unrelated... (but important read)Maybe i explains badly, my question can involve any pair of systems.
SetStopLoss works alwais if marketposition <> 0, so if you have two strategy active to one chart, stop loss (or profit target) will generate conflicts.
There's some easy way to solve this problem ?
For example i thought about put stop loss into long/short condition:
if (average(c,5)>average(c,10) then begin
buy 1 contract next bar on open;
setstoploss(100);
end;
But i found some bug doing it, stoploss does not works correctly.
Thank you again for your time.
Cordially
Please see post #5
setstoploss
viewtopic.php?f=16&t=10811
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: SetStopLoss Confilct with two systems applied to one cha
That is not a bug, that is expected behavior.if (average(c,5)>average(c,10) then begin
buy 1 contract next bar on open;
setstoploss(100);
end;
But i found some bug doing it, stoploss does not works correctly.
If SetStopLoss is not under condition - it is automatically sent intra bar on the next tick after the code knows there is an open position.
If it is under condition-the order is generated only when the condition is met (either intrabar or on bar close). The orders are valid at the broker while they are generated by your strategy.
Multiple signals applied to one chart form a single strategy. If you want your signals to manage separate positions-use them on separate charts.SetStopLoss works alwais if marketposition <> 0, so if you have two strategy active to one chart, stop loss (or profit target) will generate conflicts.
If you do not want your stop loss interfere with your other trading signal-you need to put it under condition that will generate the order only when you need it.
- t-rader
- Posts: 139
- Joined: 02 Feb 2011
- Location: Australia
- Has thanked: 11 times
- Been thanked: 27 times
Re: SetStopLoss Confilct with two systems applied to one cha
Just to confirm, Henry you are saying that you can actually use SetStopLoss within a condition? As I was under the belief you couldn't as this goes against TJ's postThat is not a bug, that is expected behavior.
If SetStopLoss is not under condition - it is automatically sent intra bar on the next tick after the code knows there is an open position.
If it is under condition-the order is generated only when the condition is met (either intrabar or on bar close). The orders are valid at the broker while they are generated by your strategy.
Multiple signals applied to one chart form a single strategy. If you want your signals to manage separate positions-use them on separate charts.
If you do not want your stop loss interfere with your other trading signal-you need to put it under condition that will generate the order only when you need it.
http://www.multicharts.com/discussion/v ... 811#p53386Please see post #5
setstoploss
viewtopic.php?f=16&t=10811
"The following keywords are Global Exits; they should not be placed inside a condition:
SetBreakEven
SetDollarTrailing
SetPercentTrailing
SetProfitTarget
SetStopLoss"
TJ's post is from almost 12 months ago so maybe things have changed since...
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: SetStopLoss Confilct with two systems applied to one cha
There is no conflict.Just to confirm, Henry you are saying that you can actually use SetStopLoss within a condition? As I was under the belief you couldn't as this goes against TJ's postThat is not a bug, that is expected behavior.
If SetStopLoss is not under condition - it is automatically sent intra bar on the next tick after the code knows there is an open position.
If it is under condition-the order is generated only when the condition is met (either intrabar or on bar close). The orders are valid at the broker while they are generated by your strategy.
Multiple signals applied to one chart form a single strategy. If you want your signals to manage separate positions-use them on separate charts.
If you do not want your stop loss interfere with your other trading signal-you need to put it under condition that will generate the order only when you need it.http://www.multicharts.com/discussion/v ... 811#p53386Please see post #5
setstoploss
viewtopic.php?f=16&t=10811
"The following keywords are Global Exits; they should not be placed inside a condition:
SetBreakEven
SetDollarTrailing
SetPercentTrailing
SetProfitTarget
SetStopLoss"
TJ's post is from almost 12 months ago so maybe things have changed since...
Please note that I did not say you "couldn't",
I said you shouldn't.
Please read attached code for context.
- t-rader
- Posts: 139
- Joined: 02 Feb 2011
- Location: Australia
- Has thanked: 11 times
- Been thanked: 27 times
Re: SetStopLoss Confilct with two systems applied to one cha
TJ thanks for the clarification (and sorry for misreading you original post), I appreciate your response. I briefly read your previous post before you edited, are you able to repost what you wrote originally wrote or maybe pm me it? as this is directly related to the situation I'm in at the moment.There is no conflict.
Please note that I did not say you "couldn't",
I said you shouldn't.
Please read attached code for context.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: SetStopLoss Confilct with two systems applied to one cha
Sorry I deleted the post; if I do not get any response (either a post or clicked "Thanks"), it means my writing was incomprehensible... and I would try to simplify it.TJ thanks for the clarification (and sorry for misreading you original post), I appreciate your response. I briefly read your previous post before you edited, are you able to repost what you wrote originally wrote or maybe pm me it? as this is directly related to the situation I'm in at the moment.There is no conflict.
Please note that I did not say you "couldn't",
I said you shouldn't.
Please read attached code for context.
Short advice -- do not put the Global Exits in a condition.
Re: SetStopLoss Confilct with two systems applied to one cha [SOLVED]
Thanks all for answers,
anyway i solved it doing a unique code like tj said:
anyway i solved it doing a unique code like tj said:
Code: Select all
if ( system1 ) then begin
input1;
input2;
stop = 100;
profit = 100;
end;
if ( system2 ) then begin
input1;
input2;
stop = 50;
profit = 50;
end;
setstoploss(stop);
setprofittarget(profit);