NexusFi: Find Your Edge


Home Menu

 





NT8 Strategy builder help.


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one userque with 2 posts (0 thanks)
    2. looks_two RoqRif with 2 posts (0 thanks)
    3. looks_3 loantelligence with 1 posts (1 thanks)
    4. looks_4 bobbydigital83 with 1 posts (0 thanks)
    1. trending_up 3,541 views
    2. thumb_up 3 thanks given
    3. group 6 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

NT8 Strategy builder help.

  #1 (permalink)
 bobbydigital83 
San Francisco Ca/USA
 
Experience: Advanced
Platform: tos
Trading: es
Posts: 29 since Jan 2019
Thanks Given: 12
Thanks Received: 7

I am trying to learn how to use the strategy builder being a new user to NT8.

I am just trying to get a simple HMA (Hull moving avg) crossover and i can't get it to work.

I am just trying to state "when the 14 HMA crosses over the 14 HMA from bar ago, go long" and "when the 14 HMA crosses below the 14 HMA from bar ago, go short" and nothing is producing on the chart.

Any help would be appreciated. Attached is screen shots of the builder...

https://imgur.com/a/pX5aHFE

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Are there any eval firms that allow you to sink to your …
Traders Hideout
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
Battlestations: Show us your trading desks!
26 thanks
The Program
18 thanks
  #2 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 682 since Jun 2009
Thanks Given: 756
Thanks Received: 787


bobbydigital83 View Post
I am trying to learn how to use the strategy builder being a new user to NT8.

I am just trying to get a simple HMA (Hull moving avg) crossover and i can't get it to work.

I am just trying to state "when the 14 HMA crosses over the 14 HMA from bar ago, go long" and "when the 14 HMA crosses below the 14 HMA from bar ago, go short" and nothing is producing on the chart.

Any help would be appreciated. Attached is screen shots of the builder...

https://imgur.com/a/pX5aHFE

You might want to consider using "Greater" and "Less" instead of "Crossover". Then use two statements instead of one.

If the current bar compare statement is Greater using "Bar 0 and bar 1, then second bar compare statement should be Less using "Bar 1 and Bar 2".

This allows you to define the "CrossOver" using values from different bars.

Reply With Quote
Thanked by:
  #3 (permalink)
 RoqRif 
Everett, WA
 
Experience: Intermediate
Platform: NinjaTrader 8
Trading: RTY, YM
Posts: 24 since Dec 2019
Thanks Given: 5
Thanks Received: 20


Does anyone know if it is possible to incorporate the ATM Strategy within Strategy Builder? If so Where can I learn?

Thanks

Reply With Quote
  #4 (permalink)
 loantelligence 
Syracuse, NY
 
Experience: Intermediate
Platform: Ninja Trader
Broker: Mirus Futures/Zen-Fire
Trading: NQ
Posts: 218 since Jan 2011
Thanks Given: 31
Thanks Received: 189

ran into that problem also.....no one had an answer.....so under NT7 i would create my strategy with strategy builder go in an copy the code that belonged to my strategy...then... you could just take the ATMStrategy ...copy it and incorporate the strategy inside of it.....give it a new name.....however..... I just did a copy and paste on the atm strategy in NT8....changed the name got an error.....not sure what it was....maybe a simple name does not match...should have gone into the compiler to see what the error was....worked under NT7

Reply With Quote
Thanked by:
  #5 (permalink)
userque
Chicago IL
 
Posts: 180 since Apr 2016
Thanks Given: 573
Thanks Received: 129


bobbydigital83 View Post
I am trying to learn how to use the strategy builder being a new user to NT8.

I am just trying to get a simple HMA (Hull moving avg) crossover and i can't get it to work.

I am just trying to state "when the 14 HMA crosses over the 14 HMA from bar ago, go long" and "when the 14 HMA crosses below the 14 HMA from bar ago, go short" and nothing is producing on the chart.

Any help would be appreciated. Attached is screen shots of the builder...

https://imgur.com/a/pX5aHFE

The HMA14 will never cross above, or below itself (another HMA14).

Reply With Quote
  #6 (permalink)
userque
Chicago IL
 
Posts: 180 since Apr 2016
Thanks Given: 573
Thanks Received: 129


RoqRif View Post
Does anyone know if it is possible to incorporate the ATM Strategy within Strategy Builder? If so Where can I learn?

Thanks

I believe I've read that that's not possible.

You'll have to code your ATM strategy into a traditional strategy (either with, or w/o using SB).

Reply With Quote
  #7 (permalink)
 RoqRif 
Everett, WA
 
Experience: Intermediate
Platform: NinjaTrader 8
Trading: RTY, YM
Posts: 24 since Dec 2019
Thanks Given: 5
Thanks Received: 20

I read on NinjaTrader.com Support Forum that SampleATMStrategy is designed to work with Strategy Builder codes after they have been unlocked. So the question is, where is the ATMStategy code placed? Before or after the SB Code. If after, do I need the namespace and public class since they are already in the SB code? How much of the beginning if this is needed? Do I start at private string or do I need everything? I have copied the SampleATMStrategy code and placed it below. Any help will be appreciated.




//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
public class SampleAtmStrategy : Strategy
{

private string atmStrategyId = string.Empty;
private string orderId = string.Empty;
private bool isAtmStrategyCreated = false;

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = NinjaTrader.Custom.Resource.NinjaScriptStrategyDescriptionSampleATMStrategy;
Name = NinjaTrader.Custom.Resource.NinjaScriptStrategyNameSampleATMStrategy;
// This strategy has been designed to take advantage of performance gains in Strategy Analyzer optimizations
// See the Help Guide for additional information
IsInstantiatedOnEachOptimizationIteration = false;
}
}

protected override void OnBarUpdate()
{
if (CurrentBar < BarsRequiredToTrade)
return;

// HELP DOCUMENTATION REFERENCE: Please see the Help Guide section "Using ATM Strategies" under NinjaScript--> Educational Resources--> https://ninjatrader.com/support/helpGuides/nt8/en-us/using_atm_strategies.htm

// Make sure this strategy does not execute against historical data
if(State == State.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 'AtmStrategyTemplate' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK ****
if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
{
isAtmStrategyCreated = false; // reset atm strategy created check to false
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", atmStrategyId, (atmCallbackErrorCode, atmCallBackId) => {
//check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback
if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId)
isAtmStrategyCreated = true;
});
}

// Check that atm strategy was created before checking other properties
if (!isAtmStrategyCreated)
return;

// 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
else if (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, please note you access the ATM strategy specific position object here
// the ATM would run self contained and would not have an impact on your NinjaScript strategy position and PnL
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




Last Updated on December 8, 2020


© 2024 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 - Privacy Policy - Downloads - Top
no new posts