Strategy is exiting my long at the wrong time - NinjaTrader Programming | futures io social day trading
futures io futures trading


Strategy is exiting my long at the wrong time
Updated: Views / Replies:459 / 4
Created: by sra18376 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
 

Strategy is exiting my long at the wrong time

  #1 (permalink)
Trading Apprentice
kansas city, ks
 
Futures Experience: Intermediate
Platform: ninjatrader
Favorite Futures: stocks
 
Posts: 16 since Jun 2014
Thanks: 0 given, 5 received

Strategy is exiting my long at the wrong time

I am having some very frustrating trouble with a strategy that I am programming right now. Basically, I want to exit my long position when the price crosses below a certain point (cutLevel). Instead what is happening is that my position is exiting when it crosses above it. I have absolutely no idea why its doing this and I have been staring at the code for hours. Can anyone help? Here is the code:

 
Code
if (Position.MarketPosition == MarketPosition.Long)
			{
				
				if (Close [0] < MyIndicator.cutLevelLong && Close [1] > MyIndicator.cutLevelLong)
				{
				ExitLong(1); 
				}

                        }
instead of Close [0] and Close [1] I have also tried Close [0] and Open [0] as well as GetCurrentAsk() and Open [0]. None of these have worked either...

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
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,460 since Sep 2013
Thanks: 1,690 given, 3,653 received
Forum Reputation: Legendary

Seems ok


Are you sure this is the piece of code that is triggering the exit?

The code seems all right.
< has priority over &&, so no () needed

and Close [0] is the last bar

Reply With Quote
 
  #4 (permalink)
 Vendor: www.innovative-trading-solutions-online.com 
Hartford, CT. USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: AMP/CQG, Kinetick
Favorite Futures: TF
 
RJay's Avatar
 
Posts: 677 since Jun 2009
Thanks: 726 given, 740 received


rleplae View Post
Are you sure this is the piece of code that is triggering the exit?

The code seems all right.
< has priority over &&, so no () needed

and Close [0] is the last bar


You are probably right but it should be tested with the additional brackets to be sure that's not the issue.

Strategies can be finicky some times.


if ((Close [0] < MyIndicator.cutLevelLong) && (Close [1] > MyIndicator.cutLevelLong))
{
ExitLong(1);
}

Reply With Quote
 
  #5 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,460 since Sep 2013
Thanks: 1,690 given, 3,653 received
Forum Reputation: Legendary


RJay View Post
You are probably right but it should be tested with the additional brackets to be sure that's not the issue.

Strategies can be finicky some times.


if ((Close [0] < MyIndicator.cutLevelLong) && (Close [1] > MyIndicator.cutLevelLong))
{
ExitLong(1);
}

to be sure you can write to the log:

if ((Close [0] < MyIndicator.cutLevelLong) && (Close [1] > MyIndicator.cutLevelLong))
{
Log("Triggered my ExitLong ", NinjaTrader.Cbi.LogLevel.Information);
ExitLong(1);
}

Reply With Quote

Reply



futures io > > > > > Strategy is exiting my long at the wrong time

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Long and Short Positions at the Same Time? tderrick Emini Index Futures Trading 39 May 31st, 2017 09:34 PM
Do What Feels Wrong, Citi's Credit Strategy For 2012 Quick Summary News and Current Events 0 December 21st, 2011 06:10 AM
Long time lurker, first time poster Anagami Beginners and Introductions 4 March 15th, 2011 08:37 PM
Looking for a simple MACD strategy. MACD Xover LONG, go LONG roshareid NinjaTrader Programming 2 April 11th, 2010 09:05 PM
NinjaTrader strategy with wrong ADXVMA values GentleTrader NinjaTrader Programming 1 August 16th, 2009 09:37 PM


All times are GMT -4. The time now is 10:29 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-10 in 0.11 seconds with 19 queries on phoenix via your IP 54.221.73.186