NexusFi: Find Your Edge


Home Menu

 





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


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one MXASJ with 13 posts (0 thanks)
    2. looks_two RJay with 4 posts (1 thanks)
    3. looks_3 max-td with 2 posts (1 thanks)
    4. looks_4 mrticks with 2 posts (0 thanks)
    1. trending_up 17,903 views
    2. thumb_up 2 thanks given
    3. group 0 followers
    1. forum 22 posts
    2. attach_file 2 attachments




 
Search this Thread
  #1 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801

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.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Penalties in Budapest, Peace Deadline in Tehran: Arsenal …
Prediction Markets & Event Contracts
The Great Rotation -- Small Caps Crushing Tech as Sectio …
Traders Hideout
Victory Day Delivers: Russia-Ukraine Ceasefire Market Cl …
Prediction Markets & Event Contracts
Prop Firm Tracked Payouts Hit $115M in Q1 but Growth Fla …
Funded Trading Evaluation Firms
Beijing Summit Closes: Xi Pledges Hormuz Help -- $1.14B …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

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)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801


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


Started this thread Reply With Quote
  #4 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801

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


Started this thread Reply With Quote
  #5 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801

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));
}


Started this thread Reply With Quote
  #6 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801

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


Started this thread Reply With Quote
  #7 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 Vendor: www.innovative-trading-solutions-online.com 
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: ES
Posts: 687 since Jun 2009
Thanks Given: 765
Thanks Received: 789

Hi MXASJ,

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

RJay


Reply With Quote
  #8 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

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
Thanked by:
  #9 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801

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!



Started this thread Reply With Quote
  #10 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 478 since Jun 2009
Thanks Given: 1,419
Thanks Received: 404



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




Last Updated on January 29, 2010


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts