Code conditions to close a long position - TradeStation | futures trading

Go Back

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

Code conditions to close a long position
Started:March 20th, 2014 (05:07 PM) by ruliann Views / Replies:228 / 2
Last Reply:March 20th, 2014 (08:56 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

Closed Thread
Thread Tools Search this Thread

Code conditions to close a long position

Old March 20th, 2014, 05:07 PM   #1 (permalink)
Trading Apprentice
Futures Experience: Beginner
Platform: Multichart
Favorite Futures: YM
Posts: 3 since Dec 2013
Thanks: 0 given, 0 received

Code conditions to close a long position

Hello everybody

I m wondering how to code "exitlong" or "exitshort" conditions.
Below, you can see my extrait of my code (which doesn't work...)

// exitlong conditions

If (Marketposition = 1) then begin
Sell currentbar at entryprice+5 ;
setstoploss (-5);
As soon as a long (buy) position is open (order n1), I would send two another orders :
order n2 => it would be placed to "myentryprice + 5 ticks" (with limit order and on the current bar)
order n3 => it would be placed to "myentryprice - 5 ticks" (with market order, a kind of stoploss...)
and "if current price = myentryprice + 2 ticks" then the order n3 is going up to this level.

Anybody have an idea please?


Old March 20th, 2014, 05:45 PM   #2 (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'll answer your question in the first thread you created and maybe @Big Mike can close this one as it is a duplicate.



Old March 20th, 2014, 08:56 PM   #3 (permalink)
Site Administrator
Manta, Ecuador
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
Big Mike's Avatar
Posts: 45,432 since Jun 2009
Thanks: 28,836 given, 79,553 received


Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

The following user says Thank You to Big Mike for this post:

Closed Thread > Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > Code conditions to close a long position

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
Having long/short position on the same market ptcm Psychology and Money Management 2 January 1st, 2014 12:29 AM
How to gradually close a position? irriss EasyLanguage Programming 17 December 5th, 2013 08:24 PM
Close Open Position on Startup MWinfrey NinjaTrader Programming 3 October 19th, 2013 01:36 PM
1 strategy with 3 long position giger2000 NinjaTrader Programming 1 October 14th, 2013 04:33 AM
Ninja Close Position / Close Button / ChartTrader vantojo NinjaTrader Programming 1 October 15th, 2012 05:51 PM

All times are GMT -4. The time now is 04:18 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.08 seconds with 19 queries on phoenix via your IP