Stop Limit Code - futures io
futures io futures trading



Stop Limit Code


Discussion in EasyLanguage Programming

Updated by numberjuani
      Top Posters
    1. looks_one Edwin Lefevre with 4 posts (0 thanks)
    2. looks_two ABCTG with 3 posts (1 thanks)
    3. looks_3 numberjuani with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 761 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 9 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Stop Limit Code

(login for full post details)
  #1 (permalink)
Scotland
 
 
Posts: 27 since May 2019
Thanks: 11 given, 3 received

Hi i'm trying to add a stop limit to my strategy.

I have the followinng code but it does not seem to be working.

var:

limit_stop_long = (entryprice-(minmove*sl));
limit_stop_short = (entryprice+(minmove*sl));

...

if MarketPosition > 0 then

setprofittarget_pt(tp);

sell next bar at limit_stop_long stop limit_stop_long limit;

if MarketPosition < 0 then

setprofittarget_pt(tp);

buytocover next bar at limit_stop_short stop limit_stop_short limit;

Reply With Quote

Can you help answer these questions
from other members on futures io?
3x Fangdango
Traders Hideout
Macros for flatten and reverse
TradeStation
I have segregated my investment and trading
Psychology and Money Management
QDEL
Stocks and ETFs
THINKorSWIM Scripting
ThinkOrSwim
 
Best Threads (Most Thanked)
in the last 7 days on futures io
VWAP for stock index futures trading?
57 thanks
Price Action Kewltech Style
19 thanks
Coronavirus COVID-19
19 thanks
Trying to locate prop firm that purchased my automated trading system
11 thanks
Margins for MES
10 thanks
 
(login for full post details)
  #3 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,198 since Apr 2013
Thanks: 386 given, 1,432 received


Edwin Lefevre,

what does "it does not seem to be working" mean? What does the code do versus what should the code do?
Are there any error messages? What is the platform you are coding this in (Multicharts or Tradestation)?

Regards,

ABCTG

Follow me on Twitter Visit my Facebook Reply With Quote
 
(login for full post details)
  #4 (permalink)
Scotland
 
 
Posts: 27 since May 2019
Thanks: 11 given, 3 received

Hey,

the stop does not seem to be triggerinng.

The position either goes to the take profit limit or keeps going until I cover the position at the end of the session.

I want it to reach the stop level and put a limit order in the book at that price. Closing my position.

I'm doinng this to stop the slippage of a market order - even if only 1 tick.

I understand that there is a chance that stop limit will not trigger but it seems that this is not triggering at all in any instance.

Im using Multicharts.

Cheers.

Reply With Quote
 
(login for full post details)
  #5 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,198 since Apr 2013
Thanks: 386 given, 1,432 received

Edwin Lefevre,

it might make sense for you to use the print reserved word to check the values you are using for the stop and limit prices when you issue the order.

Regards,

ABCTG

Follow me on Twitter Visit my Facebook Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #6 (permalink)
Scotland
 
 
Posts: 27 since May 2019
Thanks: 11 given, 3 received


ABCTG View Post
Edwin Lefevre,

it might make sense for you to use the print reserved word to check the values you are using for the stop and limit prices when you issue the order.

Regards,

ABCTG

Thanks, seems I have negative numbers.

What data does print reference?

Reply With Quote
 
(login for full post details)
  #7 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,198 since Apr 2013
Thanks: 386 given, 1,432 received

Edwin Lefevre,

it prints the values of variables and reserved words (that you included in the print statement) at the time your code executes the print statement.

Regards,

ABCTG



Edwin Lefevre View Post
Thanks, seems I have negative numbers.

What data does print reference?


Follow me on Twitter Visit my Facebook Reply With Quote
 
(login for full post details)
  #8 (permalink)
Agoura Hills, CA USA
 
Experience: Advanced
Platform: Tradestation&Multicharts
Broker: TradeStation
Trading: Futures & Equities
 
numberjuani's Avatar
 
Posts: 127 since Apr 2019
Thanks: 9 given, 94 received


Edwin Lefevre View Post
Thanks, seems I have negative numbers.

What data does print reference?

HI Edwin, From what I understand TS strategy only support StopLoss Order, which are a stop market, and Limit as SetProfitTarget.

but a way to hack it into being a limit would be :

if C crosses below (StopLevel) then
Sell next bar at (StopLevel) Limit;

In my opinion its a bad idea all around, because it will take away from the fidelity of your backtest and you will always need very fine LIBB. You will also need to make sure you have the box checked about limit order fills. I would recommend you simply add a couple of ticks of slippage and comms and design your strategy work with it.

Reply With Quote
 
(login for full post details)
  #9 (permalink)
Scotland
 
 
Posts: 27 since May 2019
Thanks: 11 given, 3 received


numberjuani View Post
HI Edwin, From what I understand TS strategy only support StopLoss Order, which are a stop market, and Limit as SetProfitTarget.

but a way to hack it into being a limit would be :

if C crosses below (StopLevel) then
Sell next bar at (StopLevel) Limit;

In my opinion its a bad idea all around, because it will take away from the fidelity of your backtest and you will always need very fine LIBB. You will also need to make sure you have the box checked about limit order fills. I would recommend you simply add a couple of ticks of slippage and comms and design your strategy work with it.

Im using Multicharts - posted in wrong section my accident.

I'm still having trouble making the stop limit work. I'm pretty sure its how im calculating the stop from the entry.. You would think that there would be a simple function for stop limit and stop limit trailing.

Problem I'm having is a I had a great system developed. But then realised that I had been market buying in and not accounting for slippage. Even with 1 tick slippage the system is broken.

I tried half slippage to account for say 50% of the time buying market is on the bid or ask the same as backtesting. It was a little better.

If I can limit in and out then I might salvage the premise of the strategy.

Reply With Quote
 
(login for full post details)
  #10 (permalink)
Agoura Hills, CA USA
 
Experience: Advanced
Platform: Tradestation&Multicharts
Broker: TradeStation
Trading: Futures & Equities
 
numberjuani's Avatar
 
Posts: 127 since Apr 2019
Thanks: 9 given, 94 received



Edwin Lefevre View Post
Im using Multicharts - posted in wrong section my accident.



I'm still having trouble making the stop limit work. I'm pretty sure its how im calculating the stop from the entry.. You would think that there would be a simple function for stop limit and stop limit trailing.



Problem I'm having is a I had a great system developed. But then realised that I had been market buying in and not accounting for slippage. Even with 1 tick slippage the system is broken.



I tried half slippage to account for say 50% of the time buying market is on the bid or ask the same as backtesting. It was a little better.



If I can limit in and out then I might salvage the premise of the strategy.



TS and MC are the same for easylanguage purposes . Is this an intraday strategy?


Sent using the futures.io mobile app

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Stop Limit Code


November 28, 2019


Upcoming Webinars and Events
 

An Afternoon With futures io member TropicalTrader

Elite only
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts