place multiple stoploss/limit orders based on entry price - EasyLanguage Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > EasyLanguage Programming

place multiple stoploss/limit orders based on entry price
Started:October 14th, 2013 (12:36 PM) by bermondsey Views / Replies:2,236 / 2
Last Reply:October 14th, 2013 (04:09 PM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

place multiple stoploss/limit orders based on entry price

Old October 14th, 2013, 12:36 PM   #1 (permalink)
Trading Apprentice
London, UK
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: European futures
Posts: 2 since Oct 2013
Thanks: 1 given, 0 received

place multiple stoploss/limit orders based on entry price

hi everyone,

i tried to incorporate a methodology into my strategy that had been described by Big Mike in one of his tutorials (VIDEO TUTORIAL: How to create an advanced MultiCharts EasyLanguage Strategy ). based on the entry price the strategy should come up with multiple stop loss and limit (take profit) orders. to keep it simple i am for now only trading one contract and therefore for each trade the strategy will only place one stoploss and one takeprofit order. i've been trying to get my head around the following problem for the past few hours but couldn't find any solution to it:

whereas the system enters a long/short position ok, it seems like when calculating stoploss and take profit level the strategy might not be using the correct entry price. it seems to be closing out trades on a rather random basis.

(for additional info i'm backtesting on FGBL futures and i am using a 1min chart).

please see code below:

inputs: stopsize(8), tp (10);

vars: ticksize (minmove/pricescale), tgt1 (tp*ticksize), st1(0), longentryprice(0), shortentryprice(0);

//enter position (only at the close of bar):

if barstatus(1) = 2 then begin

if marketposition = 0 and condition1 then
buy("enter long") next bar 1 contracts at close limit;
longentryprice = entryprice;

if marketposition = 0 and condition2 then
sellshort ("enter short") next bar 1 contracts at close limit;
shortentryprice = entryprice;


// trade management (which is causing issues):

if marketposition <> 0 then begin

if marketposition =1 then
st1 = longentryprice - (stopsize*ticksize);

sell ("longtarget_hit") 1 contracts next bar at (longentryprice + tgt1) limit;
sell ("longstop_triggered") 1 contracts next bar at st1 stop;

if marketposition = -1 then
st1 = shortentryprice + (stopsize*ticksize);

buytocover ("shorttarget_hit") 1 contracts next bar at (shortentryprice- tgt1) limit;
buytocver ("shortstop_triggered") 1 contracts next bar at st1;


any help much appreciated,



Reply With Quote

Old October 14th, 2013, 12:36 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old October 14th, 2013, 04:09 PM   #3 (permalink)
Hamburg Germany
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
Posts: 1,103 since Apr 2013
Thanks: 186 given, 622 received

I have just loaded your code into Multicharts and it seems to exit where I would expect it to do it.
Can you show some examples of trades that are exited at wrong prices?


Reply With Quote
The following user says Thank You to ABCTG for this post:

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > EasyLanguage Programming > place multiple stoploss/limit orders based on entry price

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple limit target orders toddma EasyLanguage Programming 4 August 29th, 2013 05:40 PM
can i place limit order, target price, & protective stop simultaneously shots fired ThinkOrSwim 4 June 22nd, 2013 03:31 AM
Entry, Stoploss, Profit target baruchs Index Futures Trading 15 March 3rd, 2013 09:44 AM
Is MC able to backtest strategies based on multiple range-bar-based frames? theorist MultiCharts 5 December 5th, 2012 11:36 AM
Using Limit entry, how to know if entry was execute - Multicharts arjfca EasyLanguage Programming 11 November 24th, 2010 04:33 PM

All times are GMT -4. The time now is 12:50 PM.

Copyright © 2016 by 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

Page generated 2016-10-21 in 0.09 seconds with 19 queries on phoenix via your IP