Code conditions to close a long position - MultiCharts | futures io social day trading
futures io futures trading

Code conditions to close a long position
Updated: Views / Replies:1,092 / 2
Created: by ruliann Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you dont need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Thread Tools Search this Thread

Code conditions to close a long position

  #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?

Reply With Quote
  #2 (permalink)
Hamburg Germany
Futures Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
Posts: 1,807 since Apr 2013
Thanks: 293 given, 1,099 received


there are some things that catch my eye: the limit exit order should be "next bar" and tick based exits should be converted to points. To exit a trade with the build in setstop loss the input should be positive and is dollar based.
So your code can look something like this:

Inputs: PositionBasis( false ), StopTicks( 5 ) ;

	vStopPoints	(0),
	StopAmount	(0),
	vOneTick	(0);
	vOneTick = MinMove/PriceScale;
	vStopPoints = StopTicks * vOneTick;
	StopAmount = vStopPoints * BigPointValue;	

//limit exit
If (Marketposition = 1) then 
	Sell ("LX") next bar entryprice + vStopPoints limit;

//stop loss part
if PositionBasis then
	SetStopShare ;

SetStopLoss( StopAmount ) ;

Reply With Quote
The following user says Thank You to ABCTG for this post:
  #3 (permalink)
Trading Apprentice
Futures Experience: Beginner
Platform: Multichart
Favorite Futures: YM
Posts: 3 since Dec 2013
Thanks: 0 given, 0 received


Interesting your proposition, I m going to try it

I will keep you updated !


Reply With Quote


futures io > > > > 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)

September Journal Challenge (sponsored by TopstepTrader)


Battlestations! Win $947 in prizes for showing us your trading desk!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code conditions to close a long position ruliann TradeStation 2 March 20th, 2014 08:56 PM
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
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 10:56 AM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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 2018-10-19 in 0.09 seconds with 14 queries on phoenix