Same Strategy, Same Market, Same Time = Different trades! - NinjaTrader Programming | futures io social day trading
futures io futures trading


Same Strategy, Same Market, Same Time = Different trades!
Updated: Views / Replies:4,787 / 22
Created: by MXASJ Attachments:2

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
 2  
 
Thread Tools Search this Thread
 

Same Strategy, Same Market, Same Time = Different trades!

  #11 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

I looked at the original "exampleATMstrategy" and think I found the problem. Recoded, compiled, and running against a market replay file now.

The strats were running on different but identical charts, RJay.

I'll tell ya... losing real money is a great motivator for learning more about Ninjascript.

I'll tackle the ADXVMA max pointed out next...

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


MXASJ View Post
I looked at the original "exampleATMstrategy" and think I found the problem. Recoded, compiled, and running against a market replay file now.

The strats were running on different but identical charts, RJay.

I'll tell ya... losing real money is a great motivator for learning more about Ninjascript.

I'll tackle the ADXVMA max pointed out next...

The reason I asked this about multiple charts, is be sure that all charts have the exact same historical start point.

If they start at different times, I find charts don't match up.

RJay

Reply With Quote
 
  #13 (permalink)
Elite Member
Arcata, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: index futures, oil
 
Saroj's Avatar
 
Posts: 482 since Jun 2009
Thanks: 223 given, 389 received



RJay View Post
The reason I asked this about multiple charts, is be sure that all charts have the exact same historical start point.

If they start at different times, I find charts don't match up.

RJay

RJay, is that by specifying the same number of bars or the same number of days or either? (in the Format Data Series Dialogue Box) or am I totally on the wrong track?

Reply With Quote
 
  #14 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

Well its not quite there yet. Attached two photos... one of the strat executing the ATM and one of the strat executing draw arrow. There are four instances where the strat with the ATM "missed" buy signals and one instance where it did a "buy" when it should not have.

When those two strats run live against incoming data, the indicators look exactly the same.

Attached Thumbnails
Same Strategy, Same Market, Same Time = Different trades!-es-09-09-7_17_2009-5-min-aroows.jpg   Same Strategy, Same Market, Same Time = Different trades!-es-09-09-7_17_2009-5-min-strat.jpg  
Reply With Quote
 
  #15 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

In a way it was good to be out of some of that chop... I just need to figure out why the code does not work the same between both strats.

Go Long ATM:
// ATM Strategy code cut-and-paste from NT
// Make sure this strategy does not execute against historical data
if (Historical)
return;
 
// Submits an entry limit order at the current low price to initiate an ATM Strategy if both order id and strategy id are in a reset state
// **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'ES 2 w BE and Trail' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK ****
// in the line below I've deleted && Close[0] > Open[0] from the default sampleATMstrategy code
if (orderId.Length == 0 && atmStrategyId.Length == 0 )
{
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(Action.Buy, OrderType.Market,
0, 0, TimeInForce.Day, orderId, "ES 2 w BE and Trail", atmStrategyId);

}
 
// Check for a pending entry order
if (orderId.Length > 0)
{
string[] status = GetAtmStrategyEntryOrderStatus(orderId);

// If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements
if (status.GetLength(0) > 0)
{
// Print out some information about the order to the output window
Print("The entry order average fill price is: " + status[0]);
Print(
"The entry order filled amount is: " + status[1]);
Print(
"The entry order order state is: " + status[2]);
// If the order state is terminal, reset the order id value
if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
orderId =
string.Empty;
}
}
// If the strategy has terminated reset the strategy id
elseif (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
atmStrategyId =
string.Empty;
 
if (atmStrategyId.Length > 0)
{
// You can change the stop price
if (GetAtmStrategyMarketPosition(atmStrategyId) != MarketPosition.Flat)
AtmStrategyChangeStopTarget(
0, Low[0] - 3 * TickSize, "STOP1", atmStrategyId);
// Print some information about the strategy to the output window
Print("The current ATM Strategy market position is: " + GetAtmStrategyMarketPosition(atmStrategyId));
Print(
"The current ATM Strategy position quantity is: " + GetAtmStrategyPositionQuantity(atmStrategyId));
Print(
"The current ATM Strategy average price is: " + GetAtmStrategyPositionAveragePrice(atmStrategyId));
Print(
"The current ATM Strategy Unrealized PnL is: " + GetAtm

Reply With Quote
 
  #16 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

Go long arrow:

DrawArrowUp("My up arrow" + CurrentBar, true, 0, High[0]+TickSize, Color.Green);
// delete to enable PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\LongES.wav");
// delete to enable Log("ES Sound Only LONG signal", LogLevel.Information);


Reply With Quote
 
  #17 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

Mission today for me:

1. Compare each strat's code once again, line by line.
2. Run both on the same chart using Market Replay 1x speed.
3. Work on hard coding an "ATM like" exit strategy as Mike suggested weeks ago . I've started that already on a strat I use on FESX, but struggling with how to "tighten" stops after trailing for a while.

It's 9am where I live, which gives me 5 hours until FESX opens. Let the Games begin!

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


Saroj View Post
RJay, is that by specifying the same number of bars or the same number of days or either? (in the Format Data Series Dialogue Box) or am I totally on the wrong track?

Saroj,

As a test, open charts with market data disconnected. Open and set up charts with same start date or bar #.

let charts load from resident historic data.

now connect market data source. after load is complete, run comparison testing.

RJay

Reply With Quote
The following user says Thank You to RJay for this post:
 
  #19 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received


MXASJ View Post
Mission today for me:

1. Compare each strat's code once again, line by line.
2. Run both on the same chart using Market Replay 1x speed.
3. Work on hard coding an "ATM like" exit strategy as Mike suggested weeks ago . I've started that already on a strat I use on FESX, but struggling with how to "tighten" stops after trailing for a while.

It's 9am where I live, which gives me 5 hours until FESX opens. Let the Games begin!

Just to update this thread. My problem was solved with Action #1 above. A single typo in my strat code had it trading against an indicator parameter that was different than the plotted parameter.

I've found the bug, and it was me.

On the ATM-like hard code, I'm still playing around with it. To be honest the only reason for it seems to be the issue of backtesting using data from different time frames. Important, but I need to prioritize what I need to do in NT.

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



MXASJ View Post
Just to update this thread. My problem was solved with Action #1 above. A single typo in my strat code had it trading against an indicator parameter that was different than the plotted parameter.

I've found the bug, and it was me.

On the ATM-like hard code, I'm still playing around with it. To be honest the only reason for it seems to be the issue of backtesting using data from different time frames. Important, but I need to prioritize what I need to do in NT.

MXASJ,

Good for you!!!

I think it is very important that everyone learn how to test and tweak your own programs.

Personally, I am glad I took the time to learn how to do this.

I usually tweak nearly every indicator I test or use.

RJay

Reply With Quote

Reply



futures io > > > > > Same Strategy, Same Market, Same Time = Different trades!

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 creating 95%-100% winning trades shodson NinjaTrader 85 February 1st, 2015 08:06 PM
The Worst Trades Of All Time kbit News and Current Events 0 June 26th, 2011 07:38 PM
Back to the Future! Back testing multi time frame strategy trades occuring in future mrticks The Elite Circle 10 April 2nd, 2011 10:54 AM
Making an already existing strategy only trade from a certain time to a certain time jmejedi The Elite Circle 6 February 8th, 2011 04:19 PM
Ninja T&S Trades Above and Below the Market Trafford Traders Hideout 3 January 6th, 2011 05:58 PM


All times are GMT -4. The time now is 05:52 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-15 in 0.26 seconds with 20 queries on phoenix via your IP 54.145.16.43