NexusFi: Find Your Edge


Home Menu

 





How to capture multiple conditions in a single condition?


Discussion in NinjaTrader

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




 
Search this Thread

How to capture multiple conditions in a single condition?

  #1 (permalink)
 RonKiker 
Birmingham, AL
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, YM, NQ
Posts: 34 since Apr 2012
Thanks Given: 17
Thanks Received: 23

I have 4 conditions that I monitor via indicators on my chart. If any 3 of the 4 conditions are true, I enter the trade. What I'd like to do is develop an indi that monitors these 4 conditions and then signals when any 3 of the 4 are true. It could be any 3 of the 4, and it may not necessarily be the same 3 each time, nor in the same order each time.

I think what I need to do is program a bool variable into each condition. I can handle that. Where I am having trouble is how do I monitor these 4 conditions for a "true" variable and then signal when any 3 of the 4 are true?

Does anyone have any suggestions on how I would program this logic?

Thanks,
Ron

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
Quantum physics & Trading dynamics
The Elite Circle
Strategy stop orders partially filled
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
22 thanks
Funded Trader platforms
21 thanks
Trading with Intuition
17 thanks
ApexTraderFunding.com experience and review
12 thanks
GFIs1 1 DAX trade per day journal
9 thanks
  #3 (permalink)
 Koepisch 
@ Germany
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: FDAX
Posts: 569 since Nov 2011
Thanks Given: 440
Thanks Received: 518


You can code it like that:

 
Code
int Count = 0;
bool C1, C2, C3, C4;

// *** set conditions C1..C4 ***
// ...

// *** Check Results ***
if (C1)
    Count++;
if (C2)
    Count++;
if (C3)
    Count++;
if (C4)
    Count++;

if (Count >= 3)
{
    // *** Enter Trade ***
}

Reply With Quote
Thanked by:
  #4 (permalink)
 RonKiker 
Birmingham, AL
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, YM, NQ
Posts: 34 since Apr 2012
Thanks Given: 17
Thanks Received: 23


Koepisch View Post
You can code it like that:

 
Code
int Count = 0;
bool C1, C2, C3, C4;

// *** set conditions C1..C4 ***
// ...

// *** Check Results ***
if (C1)
    Count++;
if (C2)
    Count++;
if (C3)
    Count++;
if (C4)
    Count++;

if (Count >= 3)
{
    // *** Enter Trade ***
}

Thanks, Koepisch!

That is just the mental kick in the pants that I needed.

Ron

Started this thread Reply With Quote




Last Updated on August 12, 2013


© 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