how to setup condition which change another condition in strategy? - NinjaTrader Programming | futures io social day trading
futures io futures trading


how to setup condition which change another condition in strategy?
Updated: Views / Replies:307 / 5
Created: by Tomass Attachments:1

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

how to setup condition which change another condition in strategy?

  #1 (permalink)
Elite Member
Prague Czech republic
 
Futures Experience: Beginner
Platform: Ninjatrader
Favorite Futures: Futures
 
Posts: 3 since Sep 2015
Thanks: 1 given, 0 received

how to setup condition which change another condition in strategy?

Hello guys, I am struggling finish my automatic strategy. Strategy is nearly done, just missing one last step. Hope it will be more clear from picture

I have a strategy which works with 3 indicators.
One shows me high/low till 15:30
Second shows me high/low of a day.
third shows me EMA slope (green, grey, red)

Situation 1:if ema slope is green-> if open> "high till 15:30 "= buy signal

Situation 2:if ema slope turns red -> since that time if open > high of a day = buy signal.

If EMA slope is green whole day, my entries are based on "high till 15:30" whole day.. But if Ema slope turns red (at least once, no matter if it turns back to green again) - since that moment entries only: if open > "current high of day" = buy signal(no high till 15:30 anymore...

my problem is that I do not know how to code that change. Basically - if indicator EMA slope turns red, I need to replace order (if open> "high till 15:30 "= buy signal) by order (if open > "current high of day"= buy signal).

Hope it makes some sence what I am trying to code. Will be glad for any advice.

Concrete codes for my strategy:

1. "If open> high till 15:30 -> buy"(that is what I want until some indicator change does not appear)

if (Open[0] >= HiLoOfTimeRange_WithTargetNT7(8, 0, 15, 30, 0, 0).TheHigh[0]
&& EMA (100)[0] > EMA(200)[0]
&& Open[0] > EMA(100)[0]
&& ToTime(Time[0]) >= ToTime(15, 30, 0)
&& ToTime(Time[0]) <= ToTime(21, 30, 0))
{
EnterLong(DefaultQuantity, "high breakout");
}

2. "indicator change". If that condition appears, it will trigger a change.

if (EMA (100)[0] > EMA(200)[0]
&& (EMA(100)[0] == emaslopes2(5, 15, 30, 100).EMAslopedown[0]
|| EMA(100)[0] == emaslopes2(5, 15, 30, 100).EMAdown[0])
&& ToTime(Time[0]) >= ToTime(15, 30, 0)
&& ToTime(Time[0]) <= ToTime(21, 30, 0))


3. new conditions: "if open> high of a day ->buy"

if (Open[0] >= BTH_OHLbyDay(0).CurrentHigh[1]
&& EMA (100)[0] > EMA(200)[0]
&& Open[0] > EMA(100)[0]
&& ToTime(Time[0]) >= ToTime(15, 30, 0)
&& ToTime(Time[0]) <= ToTime(21, 30, 0))
{
EnterLong(DefaultQuantity, "superlong");
}

I just do not know how to make it work all together. I was thinking about using Count if somehow, but I am not sure. Will be glad for any idea or advice. I tried ninjatrader support, but no luck.

Attached Thumbnails
how to setup condition which change another condition in strategy?-snimek-obrazovky-52-.png  
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,373 since Sep 2013
Thanks: 1,648 given, 3,510 received
Forum Reputation: Legendary


You can use boolean flag's.

your additional condition would then set or reset the flag.

Reply With Quote
The following user says Thank You to rleplae for this post:
 
  #4 (permalink)
Elite Member
Prague Czech republic
 
Futures Experience: Beginner
Platform: Ninjatrader
Favorite Futures: Futures
 
Posts: 3 since Sep 2015
Thanks: 1 given, 0 received


rleplae View Post
You can use boolean flag's.

your additional condition would then set or reset the flag.

Thank you for your advice, I will definitely do some research. To be honest, I am not very good with Ninjascript and never heard about boolean flags before. Do you know any code, or example how it works and how to use it in coding? I will try my research anyway hopefully will find some info. Thank you for your advice once again anyway!

Reply With Quote
 
  #5 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,373 since Sep 2013
Thanks: 1,648 given, 3,510 received
Forum Reputation: Legendary


Tomass View Post
Thank you for your advice, I will definitely do some research. To be honest, I am not very good with Ninjascript and never heard about boolean flags before. Do you know any code, or example how it works and how to use it in coding? I will try my research anyway hopefully will find some info. Thank you for your advice once again anyway!

From an educational point of view, you may want to look at the following :

https://futures.io/elite-automated-trading/32559-ron-s-alpha-trade-method-ninjatrader-advanced-trade-management-bot.html

At the start of the strategy you will see various booleans that drive particular behavior..

Reply With Quote
 
  #6 (permalink)
Elite Member
Chennai, India
 
Futures Experience: Intermediate
Platform: IB
Favorite Futures: ES
 
Posts: 1 since Apr 2012
Thanks: 2 given, 0 received

Like rleplae suggests reading that thread will definitely hep you learn many things and you should.

Basically if you are going to get to code, you need to have a basic idea of syntax and programming or every small obstacle will tire you. If you haven't gone through NinjaTrader Version 7 please go through to begin with.

In your case in the variable section declare the following:

bool cond1 = false;
bool cond2 = false;
bool cond3 = false;

In your barupdate method, inside each if condition just set the above flags to true

Outof all the ifs you can create the following or whatever combination to go long

if (cond1 && cond2 && cond3)

This is just to get you to the next step while you learn a bit of programming. All the best

MS

Reply With Quote

Reply



futures io > > > > > how to setup condition which change another condition in strategy?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

Introducing daytradr by Jigsaw, new stand-alone platform

Oct 19
 

RandBots: AutoTrading Bots to diversify your trading

Oct 24
 

TopstepTrader: Profiting Without Risking Your Own Money

Oct 26

Building Open Source Indicators for NT8 w/Fat Tails @ Lizard Indicators

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
link an exit condition to a particular entry condition vegtrip ThinkOrSwim 0 October 12th, 2013 08:49 AM
Strategy Template with Condition counter nanook77 Elite Automated Trading 6 April 2nd, 2012 08:58 PM
to get NT to perform an action only once while a strategy condition is true richw NinjaTrader Programming 3 February 28th, 2011 08:38 PM
Same condition every hour rajafx1 NinjaTrader Programming 5 August 13th, 2010 05:43 AM
Strategy Condition Logic >> my wetware Trader.Jon NinjaTrader Programming 2 May 24th, 2010 04:17 PM


All times are GMT -4. The time now is 05:22 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-10-19 in 0.11 seconds with 20 queries on phoenix via your IP 54.81.108.205