NexusFi: Find Your Edge


Home Menu

 





CountIf Question


Discussion in NinjaTrader

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




 
Search this Thread

CountIf Question

  #1 (permalink)
 Fugitive69 
Austin, TX
 
Experience: Intermediate
Platform: NT8
Trading: EU, SP, Crude CL
Posts: 90 since Jul 2018
Thanks Given: 33
Thanks Received: 105

Looking for a better code to use than CountIf.

Say I want to see if the last 8 bars are all "Up" bars then CountIf doesn't really work very well. It only checks to see if within the last X bars Y of them meet the criteria.

 
Code
// If in the last 10 bars we have had 8 up bars then go long
if (CountIf(() => Close[0] > Open[0], 10) > 8)
    EnterLong();
The number of bars to check must be greater than the number that meet the criteria. In the example, the number 10 must be greater than 8.

I want to see if all the bars meet the criteria. Yet when using CountIf I cannot set both variables to 8.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
What broker to use for trading palladium futures
Commodities
Better Renko Gaps
The Elite Circle
Footprint for strategy Builder
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Funded Trader platforms
68 thanks
Spoo-nalysis ES e-mini futures S&P 500
21 thanks
Trading with Intuition
18 thanks
The Trading Pit "Futures VIP" Account Journal
15 thanks
GFIs1 1 DAX trade per day journal
15 thanks




Last Updated on May 9, 2019


© 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