Strategy Builder question - futures io
futures io



Strategy Builder question


Discussion in NinjaTrader

Updated
    1. trending_up 488 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Strategy Builder question

(login for full post details)
  #1 (permalink)
 Vegas3416 
Austin Tx
 
Experience: Beginner
Platform: NinjaTrader
Trading: CME
 
Posts: 7 since Nov 2020
Thanks: 0 given, 0 received

Simple question

When setting a Boolean value in strategy builder NinjaScript
I enter a trade and set that Boolean value to true.

Then when I exit I have two variations of exits.

One is by an indicator another is if profit target is hit.

Issue is if profit target hits I donít know where that gets hit to where I can set that Boolean value back to false because it gets triggered outside of the on bar update method.

This is when I use the SetProfitTarget();

Maybe Iím just having a brain fart but any help is appreciated

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
MacdBB V402 NT804 + gradient + pullback not working on N …
NinjaTrader
Eurex Denali vs dxFeed
Sierra Chart
Experience with AGN (Introducing Broker)
Brokers
Is there inherently more opportunity in smaller markets?
Traders Hideout
Webinar: Happy Hour w/Cem Karsan
The Elite Circle
 
 
(login for full post details)
  #2 (permalink)
 Bitnut 
Skive, Denmark
 
Experience: Intermediate
Platform: NinjaTrader, MetaTrader
Trading: ES, YM, NQ
 
Posts: 3 since May 2020
Thanks: 0 given, 1 received

You have a few options.

If your boolean only tracks if you have a position or not, I would recommend just using MarketPosition instead of your boolean. If MarketPosition == MarketPosition.Flat then you don't have a position.

Otherwise, you can override one of the events that will get triggered when your order is filled:
- OnOrderUpdate (https://ninjatrader.com/support/helpGuides/nt8/?onorderupdate.htm)
- OnExecutionUpdate (https://ninjatrader.com/support/helpGuides/nt8/?onexecutionupdate.htm)
- OnPositionUpdate (https://ninjatrader.com/support/helpGuides/nt8/?onpositionupdate.htm)

I don't know which event would suit you best. Some of them will trigger on any order update, so you would have to check the parameters to only set your boolean when an order is filled and not on any update.
Use the first option if possible. It's the simplest

Reply With Quote
 
(login for full post details)
  #3 (permalink)
 Vegas3416 
Austin Tx
 
Experience: Beginner
Platform: NinjaTrader
Trading: CME
 
Posts: 7 since Nov 2020
Thanks: 0 given, 0 received


I swear I used this but wasn't getting it to trigger. Actually I was using

if(Position.MarketPosition != MarketPosition.Flat) {
Then I'm in a trade and if == to Flat then I'm not but it wasn't working.
}


I guess I can try just if(MarketPosition == MarketPosition.Flat) don't think I tried it like that as I saw the above in the docs.

Started this thread Reply With Quote
 
(login for full post details)
  #4 (permalink)
 Vegas3416 
Austin Tx
 
Experience: Beginner
Platform: NinjaTrader
Trading: CME
 
Posts: 7 since Nov 2020
Thanks: 0 given, 0 received

This worked out. I guess maybe I was calling it wrong before?? No idea.

Does anyone know how to basically hold off before taking a trade.

So what I mean is. Say a specific type of trade triggered. So lets say I enter a short and it has a specific type of tag for it. I save that tag and it goes through the trade and finishes. The tag is still saved but now I want it to wait for at least 4 bars to complete before I want it to reevaluate the indicators its looking at to see if it should re-enter a trade again.

So trade enters short -> trade closes -> tag saved -> waits 4 bars while tag is a specific type. After 4 bars tag is cleared and strategy goes back to reevaluating the setups to determine if it should re-enter again.

Started this thread Reply With Quote
 
(login for full post details)
  #5 (permalink)
 Vegas3416 
Austin Tx
 
Experience: Beginner
Platform: NinjaTrader
Trading: CME
 
Posts: 7 since Nov 2020
Thanks: 0 given, 0 received

I figured out the 4 bars situation. Hopefully this helps someone else:

// Only enter if at least 4 bars has passed since our last exit or if we have never traded yet
if ((BarsSinceExitExecution() > 4 || BarsSinceExitExecution() == -1) && CrossAbove(SMA(10), SMA(20), 1))
EnterLong();



Link for NT: https://ninjatrader.com/support/helpGuides/nt8/?standard_deviation_stddev.htm

Started this thread Reply With Quote
 
(login for full post details)
  #6 (permalink)
 Bitnut 
Skive, Denmark
 
Experience: Intermediate
Platform: NinjaTrader, MetaTrader
Trading: ES, YM, NQ
 
Posts: 3 since May 2020
Thanks: 0 given, 1 received

Weird that it didn't work before. Anyway, great that it works now

Thanks for the link, I did not know about that function, could be handy.
I think the correct link is this: https://ninjatrader.com/support/helpGuides/nt8/?barssinceexitexecution.htm
The linking is a bit strange because the address doesn't change when you browse the left menu in the help guide.

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Strategy Builder question


Last Updated on February 25, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing

Futures.io Happy Hour with Cem Karsan w/Cem Karsan

Elite only
 

Our 12-year anniversary w/ $$,$$$ prizes (check soon)

August
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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