Creating Stop Loss and Breakeven orders that do not overlap

Questions about MultiCharts and user contributed studies.
User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Creating Stop Loss and Breakeven orders that do not overlap

Postby MC_Prog » 27 Jan 2015

Hi.

Would anybody like to comment on using the built-in keywords to write PowerLanguage code that manages a trade with an initial stop loss, later moving the stop loss to be a stop exit at BreakEven, - but never having the two separate orders overlapping in the market at the same time?

The situation I'm encountering is that the stop loss order generated by SetStopLoss() is not being canceled at once when the stop exit order generated by SetBreakeven() is placed and my broker (IB, instrument FDAX) wants double the margin available in order to have these two orders present at once, even for a brief moment.

My aim is to be "never naked" from the stop-loss point of view, but also never to require double margin for what is after all only a tightening of the same stop on the same position (that already exists, having passed the initial margin check before it was put on in the first place).

When trading contracts with smaller margins, I suppose it never mattered, but the FDAX has a huge margin and having to have double that amount free and available is inconsistent with the rest of my trading campaign.

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby orion » 27 Jan 2015

Did you try setStopLoss(0) instead of setBreakEven()?

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 28 Jan 2015

Yes, thanks Orion. I'm working along that line now. The required code changes for this are somewhat extensive given my current code structure. Oh well!

Do you know if a negative number can be used (e.g. SetStopLoss( -500 ) ) in order to advance the stop into profitable territory? I can foresee similar issues as for the BE case applying to the SetDollarTrailing() and SetPercentTrailing() cases.

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby escamillo » 28 Jan 2015

there is a setting within MC that will make either all stops active or just the closest stop active (I forget what it is, sorry). Perhaps if you set the native MC setting to only have the closest stop active, be it a stop loss or a break even, then that will work for you. It is what I had to do.

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 28 Jan 2015

escamillo,

That would be superb. Do you remember whether that was a special registry setting or just a normal MC preference?

MC Support, could you chime in on this?

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby orion » 28 Jan 2015

Do you know if a negative number can be used (e.g. SetStopLoss( -500 ) ) in order to advance the stop into profitable territory? I can foresee similar issues as for the BE case applying to the SetDollarTrailing() and SetPercentTrailing() cases.
I am guessing the negative number would lead to order being rejected. The PL documentation says nothing about such case. However, the EL documentation for TS says that the number can't be negative.

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby escamillo » 28 Jan 2015

try ""Optimize Order Flow" however I could not tell you how to do that as it has been a while since I have changes settings.
Also, 9.1 may have some different functionality on the way exits and stops are treated, so you might check when new release is out.

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 02 Feb 2015

Here is an interesting point -

When code is written to (in effect) create a BreakEven stop at a certain point in a trade by changing from executing SetStopLoss( InitialStopAmt ) to executing SetStopLoss( 0 ), the result under automation, with IB, is for a ModifyOrder to take place, setting the existing stop loss order to the new price (i.e. the EntryPrice). This works!

However - the MC Order & Position Tracker makes no report of this operation anywhere. (If I've somehow missed it, please advise and accept my apologies.)

I think it would be logical and helpful for the O&PT to report this, with a filtering capability to enable/disable these for display.

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Creating Stop Loss and Breakeven orders that do not over

Postby ABC » 02 Feb 2015

I have used SetStopLoss with negative numbers a while back (two years or more) and it used to work for me. However I always felt like it was not intended to be used that way and didn't use it too much (it feels more like a bug than a feature).

Regards,
ABC
Yes, thanks Orion. I'm working along that line now. The required code changes for this are somewhat extensive given my current code structure. Oh well!

Do you know if a negative number can be used (e.g. SetStopLoss( -500 ) ) in order to advance the stop into profitable territory? I can foresee similar issues as for the BE case applying to the SetDollarTrailing() and SetPercentTrailing() cases.

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: Creating Stop Loss and Breakeven orders that do not over

Postby tony » 02 Feb 2015

If I understand what you are trying to accomplish, then perhaps you can put setstoploss() within a conditional based on MP. Something like

Code: Select all

if MP<>0
then begin
setstoploss()
end;
I haven't tried this but the set stop loss function would in theory only exist is you are long or short. Once you go flat (i.e. exiting via a stop in your example), it would no longer be valid and would cancel.

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 02 Feb 2015

To be clear, using SetStopLoss(0) does not mean turn off the stop loss. It means set the Stop order price to $0 away from the EntryPrice, which means you now have a breakeven stop. This would be done at some point after the trade has a decent favorable excursion (FE).

The point of using SetStopLoss(0) instead of SetBreakEven( TriggerPrice ) is that you avoid having both the Stop loss order and the Breakeven exit order in the market at the same time. This can save you from being required to post double the normal margin to cover the remotely possible case of overfill. (That's the theory anyway.)

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 02 Feb 2015

Wrt. using SetStopLoss( NegNum ), thanks for your report ABC.

I agree that it seems contrary to how we want to think about things, but if it actually works reliably it would be very handy to use and would assist the process of preventing margin eating double orders. (i.e. we keep using the same keyword, SetStopLoss, and avoid having the additional keywords SetDollarTrailing and/or SetPercentTrailing active and generating additional orders)

MC - could we get official engineering word on using SetStopLoss( NegNum )?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby Henry MultiСharts » 04 Feb 2015

Hello MC_Prog,

SetStopLoss with a negative value will be an order that is guaranteed to be executed. If your broker accepts such order - it will be executed at once. The broker can also reject such order.

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 06 Feb 2015

Hi. I don't understand what you mean here by "guaranteed to be executed". The only kind of order that I know of that is guaranteed to be executed is a market order.

Are you saying that SetStopLoss( NegNum ) is converted to a market order by MC, but a market order that somehow might or might not be accepted by the broker? How could it be in question, as a market order is just a market order, right?

In PowerLanguage, the SetStopLoss() keyword represents a concept. That concept is then transformed internally by the MC order engine and/or broker adaptation into an actual order. Is that a plausible way to speak of it? If so, what kind of actual order results from calling SetStopLoss( NegNum )?

I know this is really tweaky stuff, but that's why I ask, as the reality of it is obscure until explained.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby Henry MultiСharts » 10 Feb 2015

In PowerLanguage, the SetStopLoss() keyword represents a concept. That concept is then transformed internally by the MC order engine and/or broker adaptation into an actual order. Is that a plausible way to speak of it? If so, what kind of actual order results from calling SetStopLoss( NegNum )?
Hello MC_Prog,

That is correct, SetStopLoss is an algorithmic Stop order. SetStopLoss is not converted into a market order. By "guaranteed to be executed" I was referring to a case where the current price satisfies the stop order execution conditions (Stop order will execute at the specified price or worse. A worse price is a higher price for Buy and Buy to cover orders, and a lower price for Sell and Sell short orders) at the moment of sending the stop order. In such situation the order can be rejected by broker or if it is accepted - filled at once.

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 12 Feb 2015

OK, I follow that if the broker receives a stop order which would be considered already triggered at the time of receipt then some brokers might fill it immediately, and some might reject the order. That is good to be clear about.

What I'm really trying to get at though is not about "already triggered" orders.

Suppose my open trade is already $500 in profit. Then the PL code statement SetStopLoss( -100 ) is executed. This creates, conceptually, a new level for triggering the exit upon a $400 retracement of the current open profit. IOW, a trailing stop. Conceptually.

What I want to know is whether this is algorithmicly, technically, an acceptable and reliable way to code.

IOW, was the MC processing of PowerLanguage wrt. the case of SetStopLoss( -100 ) designed to accept that as a valid expression and "do the right thing", or is SetStopLoss( -100 ) more along the lines of a user coding error which is unanticipated and for which consistent results cannot be guaranteed or expected?

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MAtricks » 12 Feb 2015

I'm a little confused here at what you're getting at but maybe something like this will help?

Code: Select all

Inputs:
SL_1( 1000 ),
SL_2( 500 ),
SL_3( 250 ) ;

Variables:
SL( 0 ) ;

Condition1={Condition for largest stop} ;
Condition2={Condition for 2nd largest stop} ;
Condition3={Condition for 3rd largest stop} ;

if Condition1 then SL = SL_1 ;
if Condition2 then SL = SL_2 ;
if Condition3 then SL = SL_3 ;

SetStopLoss( SL ) ;
I'd suggest getting away from P/L all together and use Price levels in your exits when you're manipulating them like this.

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 12 Feb 2015

Hi MAtricks.

That's a nice idiom you posted (I like it!), but it is orthogonal to what I'm asking about, which has to do specifically with using a negative number as the argument to SetStopLoss().

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MAtricks » 12 Feb 2015

I wrote that quick example to get you started on the right thought process of using multiple stop orders.

Convert this code/idea to PRICE so you can use Stop orders and place them wherever needed by way of price levels instead of dollar amounts.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby Henry MultiСharts » 13 Feb 2015

Suppose my open trade is already $500 in profit. Then the PL code statement SetStopLoss( -100 ) is executed. This creates, conceptually, a new level for triggering the exit upon a $400 retracement of the current open profit. IOW, a trailing stop. Conceptually.
In such case SetStopLoss( -100 ) will not be guaranteed to be executed. Yes, it will be $400 retracement of the current open profit (or $100 profit from entry).

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 14 Feb 2015

OK, so the actual type of the order the broker from the broker's POV in this case is a Stop order, right?

Since that stop order is a perfectly normal plenty-far-from-the-current-market-and-not-yet-triggered stop exit order, there should not be any reason to expect it to be other than accepted and then filled when/if triggered. Is that right?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby Henry MultiСharts » 18 Feb 2015

OK, so the actual type of the order the broker from the broker's POV in this case is a Stop order, right?
That is correct.
Since that stop order is a perfectly normal plenty-far-from-the-current-market-and-not-yet-triggered stop exit order, there should not be any reason to expect it to be other than accepted and then filled when/if triggered. Is that right?
This is not something that is related to MultiCharts. Please contact your broker directly regarding this question.

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 18 Feb 2015

Suppose my open trade is already $500 in profit. Then the PL code statement SetStopLoss( -100 ) is executed. This creates, conceptually, a new level for triggering the exit upon a $400 retracement of the current open profit. IOW, a trailing stop. Conceptually.
In such case SetStopLoss( -100 ) will not be guaranteed to be executed. Yes, it will be $400 retracement of the current open profit (or $100 profit from entry).
Hi Henry. Thanks for your most recent reply, but it puzzles me. Since MC is sending an ordinary stop order, and since the order is far from the market when sent/received, I don't understand why the qualification "In such case SetStopLoss( -100 ) will not be guaranteed to be executed."

I can try to get the broker's feedback as might be relevant, but I have to have a question to ask. "Do you execute stop orders?" does not seems like a sensible question. All brokers execute stop orders. What is special about this case? What should I be asking the broker, given the scenario described?

escamillo
Posts: 203
Joined: 25 Mar 2011
Has thanked: 23 times
Been thanked: 56 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby escamillo » 19 Feb 2015

Henry might be referring to possible instances in which you can have a stop in place, however at perhaps unusual times not have a stop honored: page 14 of the attached CME booklet indicates that at times they may not honor stops even those residing on their servers. So believe Henry may be saying that once a stop is placed at a broker or an exchange, it is the responsibility of the broker and the exchange to make the stop happen, subject to their limitations and rules.

Another possibility, probably not quite as related to what Henry is saying, is that if your stop resides on your computer (a stop is sent when a price is reached) and not at the broker or the exchange, then if you have a data interruption such that the market price moves through your stop price during a data interruption, then after reconnection, your stop may not be triggered.
CME Globex Reference Guide.pdf
(345.27 KiB) Downloaded 877 times

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 19 Feb 2015

Good comments and good reference, escamillo. Thanks.

Henry, could you say if these were in fact the motivations for your earlier comments, or was there something else behind them?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby Henry MultiСharts » 19 Feb 2015

MC_Prog,

By "will not be guaranteed to be executed" I was referring to "not-yet-triggered stop", which normally should be accepted by the broker. What you need to check with your broker is - whether "plenty-far-from-the-current-market" stop order will be accepted or not.

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 19 Feb 2015

Hi Henry.

By "plenty-far-from-the-current-market" I meant "nowhere-near/not-possibly-yet triggered", or alternatively as you simply say "not-yet-triggered stop". I think this may be a case of differing interpretations of the words. Were you thinking I meant "already triggered"?

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MAtricks » 19 Feb 2015

Your point is to have both a breakeven stop and a stoploss, but never to have more than 1 stop order resting in the market because of heavy margin, correct?

Why isn't anyone saying that using the native Setstoploss with a negative input is probably not the best way to do this?

I started coding it up for you and then realized I had this piece from Ruletrader (TS) from years back. **This is not my code** and I would have done it quite a bit differently but it looks clean and will get the job done. Give it a go..

Code: Select all

{
Strategy Name: F_BreakEvenWoffset (Breakeven stop with offset and stop loss )
Date: 5/21/2008
Posted by ruletrader7320
<a href="https://community.TS.com/Discussions/Topic.aspx?Topic_ID=77238 " target="_blank">https://community.TS.com/Discussions/Topic.aspx?Topic_ID=77238 </a>
(Updated with points for inputs from code posted for Topic ID=72426)
}

[IntrabarOrderGeneration = false]

{**********************************************************
Inputs
***********************************************************}
inputs:
numContracts(100000),
BEFloorPoints(.0005),
BEOffSetPts(0.00025),
StopLossPts(.0020),
PlotOn(false); // Set to false for long tests

vars:
BEvenON(true),
MP(0);

MP = MarketPosition;

{****************************************************
BEGIN BreakEven Stop
*****************************************************}
variables:
IntraBarPersist BEstate( 0 ),
IntraBarPersist BEStopPrice( 0 ),
IntraBarPersist BEStopPriceStaged( 0 ),
IntraBarPersist BEFloorPrice( 0 ),
IntraBarPersist StopLossPrice( 0 );

if BEvenON then begin
{************************************************* *********
1st FLOOR LEVEL: Establish floor level
************************************************** *********}
if BarsSinceEntry = 0 then begin
if MP = 1 then begin
BEFloorPrice = EntryPrice + BEFloorPoints;
BEStopPriceStaged = EntryPrice + BEOffSetPts;
StopLossPrice = EntryPrice - StopLossPts;
BEstate = 1;
end
else if MP = -1 then begin
BEFloorPrice = EntryPrice - BEFloorPoints;
BEStopPriceStaged = EntryPrice - BEOffSetPts;
StopLossPrice = EntryPrice + StopLossPts;
BEstate = 1;
end;
end;

{************************************************* *********
1st FLOOR LEVEL: Check if floor level hit
************************************************** *********}
if MP = 1 and BEstate = 1 then begin
if high >= BEFloorPrice then begin
BEstate = 2;
BEStopPrice = BEStopPriceStaged;
end;
end
else if MP= -1 and BEstate = 1 then begin
if low <= BEFloorPrice then begin
BEstate = 2;
BEStopPrice = BEStopPriceStaged;
end;
end;

{********************************************************
Execute stop loss until break even stop triggered
*********************************************************}
if BEstate = 1 then begin
if MarketPosition = 1 then begin
sell ("StopLossS") next bar all contracts at StopLossPrice stop ;
end
else if MarketPosition = -1 then begin
buyToCover ("StopLossL") Next bar all contracts at StopLossPrice stop;
end;
end
{********************************************************
Execute break even stop, moving up stop loss to offset
*********************************************************}
else if BEstate > 1 then begin
if MarketPosition = 1 then begin
sell ("BEStopS") next bar all contracts at BEStopPrice stop ;
end
else if MarketPosition = -1 then begin
buyToCover ("BEStopL") Next bar all contracts at BEStopPrice stop;
end;
end; // floorHit


if plotON and MP <> 0 then begin
var: TLID01(0);
TLID01 = TL_New(Date, Time, BEFloorPrice, Date[1], Time[1], BEFloorPrice ) ;
Value1 = TL_SetColor(TLID01,blue);
Value1 = TL_SetSize(TLID01, 2 ) ;
end;

end; // BEvenOn

{
{***********************************************************************************
Sample code to get trades to check strategy requirments
************************************************************************************}
{ --- fast and slow exponential moving average setups --- }

variables: FastLength(16), SlowLength(32), FastAvg( 0 ), SlowAvg( 0 ),
buyON(false), sellShortON(false);

FastAvg = XAverage( Close, FastLength ) ;
SlowAvg = XAverage( Close, SlowLength ) ;


if MP = 0 then begin
{ --- long entry conditions for XMA cross over--- }
if CurrentBar > 1 and FastAvg > SlowAvg then begin
buyON = true;
end

{ --- short entry conditions for XMA cross under--- }
else if CurrentBar > 1 and FastAvg < SlowAvg then begin
sellShortON = true;
end;

{***************************************************
Force market entries to occur only at end of bar
****************************************************}
if BarStatus(1) = 2 then begin
if buyON then begin
buyON = false;
buy ("TestLE") next bar numContracts contracts at market;
end
else if sellShortON then begin
sellShortON = false;
sellShort ("TestSE") next bar numContracts contracts at market;
end;
end;

end;

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 20 Feb 2015

Hi MAtricks.

The code you posted is on-point, clear and understandable. Very decent of you to dig it up and post it!

I think that since [IntrabarOrderGeneration = false] it will be the case that changes in the BEstate will only happen on bar closures, and this is unlike (for example) using SetBreakeven( TriggerDollars ), which will operate "under the hood" to activate a BE stop "instantly" after the first tick where price reaches TriggerDollars of profit for the position. Right?

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 20 Feb 2015

FWIW, my latest code mods here have successfully collapsed the combined use of SetStopLoss() and SetBreakEven() into using only SetStopLoss() with the addition of the SetStopLoss( 0 ) case. Since this seems to be working fine, I'm interested in the possibility of continuing along the same line to use SetStopLoss( NegNum ).

So far, no one has said "Trying to use SetStopLoss( NegNum ) is a bad idea, and here's why ...".

Nor has anyone said "Yes, it's a perfectly good way to go ..." <g>

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby orion » 20 Feb 2015

I'm interested in the possibility of continuing along the same line to use SetStopLoss( NegNum ). So far, no one has said "Trying to use SetStopLoss( NegNum ) is a bad idea, and here's why ...". Nor has anyone said "Yes, it's a perfectly good way to go ..." <g>
Worth exploring further since MC is saying it will not reject the order. If MC does not reject the order, then it should be a valid stop order with IB. IB doesn't get to see how your code finessed the stop with a negative value for the SetStopLoss parameter. I am interested in how this works out for you.

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MAtricks » 20 Feb 2015

Hi MAtricks.

The code you posted is on-point, clear and understandable. Very decent of you to dig it up and post it!

I think that since [IntrabarOrderGeneration = false] it will be the case that changes in the BEstate will only happen on bar closures, and this is unlike (for example) using SetBreakeven( TriggerDollars ), which will operate "under the hood" to activate a BE stop "instantly" after the first tick where price reaches TriggerDollars of profit for the position. Right?
You can easily modify this code to have IOG on. It wasn't a finished piece, just a roadmap...

Go about this project however you see fit, I'm just lending my tidbits along the way :) My experience says to get far away from these exits if ever possible so working this hard to keep them doesn't make much sense to me. I'm glad that it seems to be working in your tests and I'll be watching to see what you come up with.

User avatar
MC_Prog
Posts: 330
Joined: 28 Feb 2007
Has thanked: 64 times
Been thanked: 35 times

Re: Creating Stop Loss and Breakeven orders that do not over

Postby MC_Prog » 20 Feb 2015

My experience says to get far away from these exits if ever possible
Do you mean SetStopLoss() and SetBreakeven(), etc. ? Any comments or references on specific problems they create are always welcome.


Return to “MultiCharts”