NexusFi: Find Your Edge


Home Menu

 





CountIf Question


Discussion in NinjaTrader

Updated
    1. trending_up 704 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?
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
Increase in trading performance by 75%
The Elite Circle
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
GFIs1 1 DAX trade per day journal
11 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
10 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