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,790 / 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!

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

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

Hey All,

I've been sim trading a strategy that calls an ATM when getting buy or sell signals, and last night copied it and took out the buy/sell actions and replaced them with playsound and drawarrow commands so it was a "signal only" strat.

I then ran both on live ES data, using signals generated by the "signal only" strat to manually enter trades in one of my brokerage accounts. All in a days work.

BUT... the "signal only" strat was generating calls that the sim trader never took, and in some cases sim trader kicked in a few bars later. The "signal only" strat appeared to follow the conditions in the strat perfectly, while the one that does the buy/sell was less predictable.

Any ideas on where I should look for errors?

FWIW the ATM call strategy is cut-and-paste from the factory example.

Reply With Quote
 
  #2 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

hi,
i try to understand : you have

1) your trading-signals/logic coded as an indicator to show arrows in the chart + give a sound

and

2) your trading-signals/logic as a strategy to start sim/live -trades

these 2 behave different.

right till here ?

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


No they are both strategies. The difference is instead of buy/sell as an action its playsound/draw bar.

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

The sound and draw one:

///</summary>
protectedoverridevoid OnBarUpdate()
{
///GO LONG: Conditions followed by ATM Strategy execution.
if (VSuperTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageType.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode.ATR).Signal[0] == 1
&& (ATRratio(14, 7, 1).Ratio[0] >= 1)
&& (ADXVMA_sharky_paint(
6, true).Main[0] > ADXVMA_sharky_paint(6, true).Main[1])
&& (ECO2New2(
7, 4, 21).Main[0] > ECO2New2(7, 4, 21).Signal[0])
&& Rising(ECO2New2(
7, 4, 21).Main) == true)

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

}
///GO SHORT: Conditions followed by ATM Strategy execution.

etc etc etc

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

The call ATM one has this instead of the drawarrowup, etc:

{
// 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 ****
if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[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: " + GetAtmStrategyUnrealizedProfitLoss(atmStrategyId));
}

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

So the the conditions that lead to an an action are the same. Is there anything in the call ATM code... wait... what's that close[0]>open[0]?

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

Hi MXASJ,

Are both strategies running on the same chart or different charts?

RJay

Reply With Quote
 
  #8 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

i know from some examples where the printed values of indicators hasnt been the same as the values using this indicator in a strategy - always because of a special + unique coding-problem.
so your arrow+sound is a plotting-thing + order-execution is a strategy-thing.
i see you use the ADXVMA -- thats one of the examples i am talking about -- i had trouble too with that some time ago.
here is a link -- have a look + test it .

ADXVMA strategy problem? - NinjaTrader Support Forum

Indicator output is different when invoked by strategy - NinjaTrader Support Forum

good luck --- and report please

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

vielen danke max. Before I get too carried away what would the Close[0]>Open[0] thing in the ATM start do? Only long after a postive bar?

"if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])" is the example ATM strat code from NT (what I'm using).

I'll try the tips NTJosh mentioned as well.

Also looking at splitting the strat (actually the ATM it fires) into two... europe open and NYSE open. Wider stops on the NYSE open.

But now I need to sleep. Strat running on sim account. G'nite!



Reply With Quote
 
  #10 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
 
Posts: 456 since Jun 2009
Thanks: 1,359 given, 383 received



MXASJ View Post
...
"if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])" is the example ATM strat code from NT (what I'm using)....


I believe those tell you orderId.Length == 0 means no pending order

atmStrategyId.Length== 0 means not in a current trade

if you find something different, let us know
thanks
kz

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 07:11 AM.

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-16 in 0.35 seconds with 20 queries on phoenix via your IP 54.226.113.250