Help exit a trade in easylanguage! - EasyLanguage Programming | futures io social day trading
futures io futures trading


Help exit a trade in easylanguage!
Updated: Views / Replies:687 / 8
Created: by kidvic 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 90,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 donít 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

Reply
 
Thread Tools Search this Thread
 

Help exit a trade in easylanguage!

  #1 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received

Help exit a trade in easylanguage!

If close>close[1] then buy this bar at close;
{Target & Stop Exits go here}
now, I have seen that you can have something like
setprofittarget(300)
and
setstoploss(100)
and while this will get you out when you have made 300 or lost 100, this is NOT what I want.
I want to be able to give it a price value.
For example, you enter at the close and the price you paid is 20.50, and you want to get out at 25.50
How do I tell it to get me when the last is 25.50? I do not want to tell it to get me out at 5.00 because that price target can change.

Reply With Quote
 
  #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.

 
  #3 (permalink)
Elite Member
Colorado
 
Futures Experience: Advanced
Platform: MultiCharts
Broker/Data: IB & Iqfeed
Favorite Futures: ES , CL
 
sptrader's Avatar
 
Posts: 533 since Apr 2010
Thanks: 1,080 given, 668 received


Maybe something like this:
If marketposition = 1 then sell next bar at 25.50 limit;
I think it may only be valid only for the next bar though.

Reply With Quote
 
  #4 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received


sptrader View Post
Maybe something like this:
If marketposition = 1 then sell next bar at 25.50 limit;
I think it may only be valid only for the next bar though.

Thanks @sptrader
It is only for next bar. I've read the reserved word definition.
This won't work. Thanks anyway. This is frustrating .

Reply With Quote
 
  #5 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 855 received
Forum Reputation: Legendary

kidvic,

sptrader's suggestion will work on all bars as long as MarketPosition = 1 - the order won't get cancelled at the end of the next bar.
You can also use the build in profit target and stop loss from your first post, but instead of using fixed values you can change them according to the price you want to exit at.
Look into the reserved word SetStopShare and then you can just use the difference between your entry and exit in dollars as the value for the target.

Regards,
ABCTG


kidvic View Post
Thanks @sptrader
It is only for next bar. I've read the reserved word definition.
This won't work. Thanks anyway. This is frustrating .


Reply With Quote
 
  #6 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received


ABCTG View Post
kidvic,

sptrader's suggestion will work on all bars as long as MarketPosition = 1 - the order won't get cancelled at the end of the next bar.
You can also use the build in profit target and stop loss from your first post, but instead of using fixed values you can change them according to the price you want to exit at.
Look into the reserved word SetStopShare and then you can just use the difference between your entry and exit in dollars as the value for the target.

Regards,
ABCTG

 
Code
If MarketPosition = 0 then
    Begin
    If Open > Close then 
    Begin
      Buy ("Enter long") 1 Contract This Bar At Close;
    End;
    

    If MarketPosition = 1 then 
    Begin
     
      Sell ("Exit long") 1 Contract Next Bar At Market;
    End;
end
So this is what I have. The script enters a position, but It does NOT exit my position at next bar as I have told it to do.
it should know that I have a marketposition of 1 since I can visually see an entry on the chart.
What is going on? Why isn't it getting me out?

Reply With Quote
 
  #7 (permalink)
Elite Member
Colorado
 
Futures Experience: Advanced
Platform: MultiCharts
Broker/Data: IB & Iqfeed
Favorite Futures: ES , CL
 
sptrader's Avatar
 
Posts: 533 since Apr 2010
Thanks: 1,080 given, 668 received

The way it's written, I think it will exit at the close of the next bar... if you want it to exit at the 1st tick of the next bar instead of waiting until the close, you need to use something like: IntrabarOrderGeneration = true; at the beginning of your code.
That's what it's called in Multicharts, I think there is an Easylanguage equivalent, if not the same...

Reply With Quote
 
  #8 (permalink)
Trading for Fun
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkOrSwim
Favorite Futures: Options, Futures
 
Posts: 92 since Mar 2015
Thanks: 13 given, 2 received


sptrader View Post
The way it's written, I think it will exit at the close of the next bar... if you want it to exit at the 1st tick of the next bar instead of waiting until the close, you need to use something like: IntrabarOrderGeneration = true; at the beginning of your code.
That's what it's called in Multicharts, I think there is an Easylanguage equivalent, if not the same...

When I've used this exact code on my chart on multicharts, it creates an entry, but it doesn't create an exit. It only shows the long entry. It doesn't even get me out at next bar.

Reply With Quote
 
  #9 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 855 received
Forum Reputation: Legendary

kidvic,

this is to be expected from the way you wrote your code. Your exit check is within the MarketPosition = 0 check, so the condition can never become true.

Regards,
ABCTG


kidvic View Post
When I've used this exact code on my chart on multicharts, it creates an entry, but it doesn't create an exit. It only shows the long entry. It doesn't even get me out at next bar.


Reply With Quote

Reply



futures io > > > > > Help exit a trade in easylanguage!

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strategy stops working at trade exit plus error ShruggedAtlas Elite Automated NinjaTrader Trading 5 June 17th, 2015 01:39 PM
Under what conditions do you exit a trade before your target or stop has been hit? Itchymoku Traders Hideout 27 March 2nd, 2015 12:32 AM
Trade Exit Optimization on Actual Historical Trades with Tick Level Backtesting Forthinords Elite Automated Trading 1 September 19th, 2014 01:26 PM
Good Trade, Bad Trade, Winning Trade, Losing Trade David_R Traders Hideout 2 April 16th, 2013 04:51 PM
Reducing Drawdown Trade Exit techniques ideas leinster Elite Automated Trading 2 December 6th, 2012 01:13 AM


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

Copyright © 2017 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
Page generated 2017-12-18 in 0.12 seconds with 19 queries on phoenix via your IP 54.196.201.241