NexusFi: Find Your Edge


Home Menu

 





Getting a stop loss to transmit based off desired entry rather than broker fill


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one NeverHappy with 2 posts (1 thanks)
    2. looks_two martingjesus with 2 posts (1 thanks)
    3. looks_3 ABCTG with 1 posts (0 thanks)
    4. looks_4 Jura with 1 posts (1 thanks)
    1. trending_up 1,125 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Getting a stop loss to transmit based off desired entry rather than broker fill

  #1 (permalink)
NeverHappy
London
 
Posts: 2 since Jul 2017
Thanks Given: 1
Thanks Received: 1

Hi all

I've been using MC for quite some time and never quite got around to figuring this out - some weeks it effects my results more than others and this week was one such example so I've endeavoured to try and solve it. I much appreciate the assistance.

I find some of the auto trading logic in MC a tad opaque, but I might just be a bit slow, more than possible!

Essentially what I want to do is have stop losses transmit not based on the broker fill, but on where the strategy wanted to enter. So for example if I wanted to short the EURUSD at 1.1500 with a 20 pip stop, regardless of what fill I get from the broker I want my stop loss transmitted at 1.1520 and not say 1.1518 if the entry price at broker was actually ultimately 1.1498 or similar due to spread/slippage etc. However I don't want to use async trading as I've had some utterly bizarre results using async in the past and I think it's best left alone.

I'm aware that this means I have to accept the spread as an extra cost and that the average loss will be magnified. I modelled this and the overall cost of the spread added on stops vs being stopped out early was quite a bit less, especially since my stops tend to be in areas where price is likely to meet resistance (this logic can become flawed if the stop is now just prior to that resistance as a result of an inferior broker fill vs strategy placement if you see what I mean).

Is there any combination of auto trading settings that can achieve this or would I have to code a manual stop using IOG where it takes the strategy price and calculates the stop based on that, ignoring the broker price. My only concern about this is that I seem to recall the strategy price can end up sync'ed with the broker price in sync mode so even that may not work.

I am using the PowerLanguage version of MC.

Thanks very much!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
About a successful futures trader who didnt know anythin …
Psychology and Money Management
REcommedations for programming help
Sierra Chart
What broker to use for trading palladium futures
Commodities
ZombieSqueeze
Platforms and Indicators
 
  #2 (permalink)
 
martingjesus's Avatar
 martingjesus 
Madrid Spain
 
Experience: Master
Platform: Multicharts, Tradestation
Broker: Tradestation, InteractiveBrokers
Trading: Stocks
Posts: 15 since Sep 2015
Thanks Given: 10
Thanks Received: 5

Hello,

I thought of the same recently and I think it is not possible to change the MC settings to take as reference the "SIM" price to calculate the stop.

As you pointed out, you will have to save in a variable that value within the code with IOG enabled. For example:

If ... then Begin

Entryprice = x;
Stopprice = x -0.002;
Buy next bar Entryprice stop;
If marketposition = 1 then Sell next bar Stopprice stop;

End;

This might work.

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
NeverHappy
London
 
Posts: 2 since Jul 2017
Thanks Given: 1
Thanks Received: 1



martingjesus View Post
Hello,

I thought of the same recently and I think it is not possible to change the MC settings to take as reference the "SIM" price to calculate the stop.

As you pointed out, you will have to save in a variable that value within the code with IOG enabled. For example:

If ... then Begin

Entryprice = x;
Stopprice = x -0.002;
Buy next bar Entryprice stop;
If marketposition = 1 then Sell next bar Stopprice stop;

End;

This might work.

Thanks for your reply.

Yeah agreed because using sync trading the keyword EntryPrice (which is technically a strategy based keyword) becomes synced with the broker fill report anyway and I'm not aware of any keyword for entry price that disregards broker fill.

As you say I think the best way is to take the entry signal generated stop price and feed that to the stop loss signal to build a stop loss from.

With relatively complex entry logic this can be a bit of a pain to think through and ensure nothing weird is going to happen in live - probably the best thing to do is assign a stop loss variable on entry using "if barssinceentry = 0" to stop the stop loss being moved around as redundant entry signals are generated post entry. So you wouldn't have a stoploss(entryvar), but rather a stoploss(stopvar) where stopvar was assigned to entryvar when barssinceentry was zero. It's a shame because MC does essentially "know" or at least knew its desired entry price, but this seems to disappear as a global variable.

I do have an open ticket with MC themselves about this so will post in the thread if they have an easier option.

Other options are obviously things like adding on the mean spread to your stop loss etc, but this is inelegant.

Reply With Quote
Thanked by:
  #4 (permalink)
 
martingjesus's Avatar
 martingjesus 
Madrid Spain
 
Experience: Master
Platform: Multicharts, Tradestation
Broker: Tradestation, InteractiveBrokers
Trading: Stocks
Posts: 15 since Sep 2015
Thanks Given: 10
Thanks Received: 5

Neverhappy,

Eager to hear what the MC team has to say about it, I'm sure they can have a workaround. If not, some complex coding is due and beware of the possible contingencies that often arise in this situations..

Follow me on Twitter Reply With Quote
  #5 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


NeverHappy View Post
Yeah agreed because using sync trading the keyword EntryPrice (which is technically a strategy based keyword) becomes synced with the broker fill report anyway and I'm not aware of any keyword for entry price that disregards broker fill.

If I understand this topic and your goal correctly, you can also use the average entry price from the broker side as a good substitute for the `EntryPrice` keyword. See the AvgEntryPrice_at_Broker keyword, for instance.

Reply With Quote
Thanked by:
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

NeverHappy,

based on your goals coding a stop yourself using IOG appears to be the best option. The price "where the strategy
wanted to enter" sounds like something that you can track within your code, then just base the stop on that price.
Maybe add an option to use the actual fill price in case the fill would result in an immediate stop out due to the computed stop being surpassed already.

Regards,

ABCTG



NeverHappy View Post
Hi all

I've been using MC for quite some time and never quite got around to figuring this out - some weeks it effects my results more than others and this week was one such example so I've endeavoured to try and solve it. I much appreciate the assistance.

I find some of the auto trading logic in MC a tad opaque, but I might just be a bit slow, more than possible!

Essentially what I want to do is have stop losses transmit not based on the broker fill, but on where the strategy wanted to enter. So for example if I wanted to short the EURUSD at 1.1500 with a 20 pip stop, regardless of what fill I get from the broker I want my stop loss transmitted at 1.1520 and not say 1.1518 if the entry price at broker was actually ultimately 1.1498 or similar due to spread/slippage etc. However I don't want to use async trading as I've had some utterly bizarre results using async in the past and I think it's best left alone.

I'm aware that this means I have to accept the spread as an extra cost and that the average loss will be magnified. I modelled this and the overall cost of the spread added on stops vs being stopped out early was quite a bit less, especially since my stops tend to be in areas where price is likely to meet resistance (this logic can become flawed if the stop is now just prior to that resistance as a result of an inferior broker fill vs strategy placement if you see what I mean).

Is there any combination of auto trading settings that can achieve this or would I have to code a manual stop using IOG where it takes the strategy price and calculates the stop based on that, ignoring the broker price. My only concern about this is that I seem to recall the strategy price can end up sync'ed with the broker price in sync mode so even that may not work.

I am using the PowerLanguage version of MC.

Thanks very much!


Follow me on Twitter Reply With Quote




Last Updated on July 25, 2017


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts