NexusFi: Find Your Edge


Home Menu

 





Idea


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Kush with 3 posts (0 thanks)
    2. looks_two Fat Tails with 2 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 kkfx with 1 posts (0 thanks)
    1. trending_up 3,606 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
Kush
San Sebastian/Spain
 
Posts: 12 since Sep 2011
Thanks Given: 0
Thanks Received: 1

Hi, I have found this idea at Jeffrey Katz Book but I don't get it at all. Can anyone help me to programm this?
If a new 50-day high has occurred within the last 10 days, then Buy. If a new 50-day low has occurred within the last 10 days, then Sell.


// Condition set 1
if (MAX(High, 50)[0] > MAX(High, 10)[0])
{
EnterLong(DefaultQuantity, "");
}

// Condition set 2
if (MIN(Low, 50)[0] < MIN(Low, 10)[0])
{
EnterShort(DefaultQuantity, "");
}

I'm not sure if it's like this.... some help...


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
After $87M Settles NO: Irans Nuclear Redline Sets Up the …
Prediction Markets & Event Contracts
Al Arabiya: US-Iran Draft Deal Within Hours Contains Hor …
Prediction Markets & Event Contracts
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #3 (permalink)
 
kkfx's Avatar
 kkfx 
Mumbai, India
 
Experience: Intermediate
Platform: MT4, NT8,TradingView
Broker: AMP
Trading: Index,currencies
Posts: 117 since Jul 2010
Thanks Given: 326
Thanks Received: 163



Kush View Post
Hi, I have found this idea at Jeffrey Katz Book but I don't get it at all. Can anyone help me to programm this?
If a new 50-day high has occurred within the last 10 days, then Buy. If a new 50-day low has occurred within the last 10 days, then Sell.


// Condition set 1
if (MAX(High, 50)[0] > MAX(High, 10)[0])
{
EnterLong(DefaultQuantity, "");
}

// Condition set 2
if (MIN(Low, 50)[0] < MIN(Low, 10)[0])
{
EnterShort(DefaultQuantity, "");
}

I'm not sure if it's like this.... some help...


I guess you can use 50 period SMA applied to the high of bars. Now when close of current bar crosses above this 50 period SMA for highs with look back period of 10 it will meet the condition.

// Condition set 1
if (CrossAbove(Close, SMA(High, 50), 10))
{
EnterLong(DefaultQuantity,
"");
}
// Condition set 2
if (CrossBelow(Close, SMA(Low, 50), 10))
{
EnterShort(DefaultQuantity,
"");
}

You can use the wizard to enter these conditions. Use input series as high or low of price bars.


Reply With Quote
  #4 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


Kush View Post
Hi, I have found this idea at Jeffrey Katz Book but I don't get it at all. Can anyone help me to programm this?
If a new 50-day high has occurred within the last 10 days, then Buy. If a new 50-day low has occurred within the last 10 days, then Sell.


// Condition set 1
if (MAX(High, 50)[0] > MAX(High, 10)[0])
{
EnterLong(DefaultQuantity, "");
}

// Condition set 2
if (MIN(Low, 50)[0] < MIN(Low, 10)[0])
{
EnterShort(DefaultQuantity, "");
}

I'm not sure if it's like this.... some help...


Sorry, these conditions do not make sense. Let us examine

 
Code
if (MAX(High, 50)[0] > MAX(High, 10)[0])
This means that the high of the last 50 bars was higher than the high at the last 10 bars. This is the case if after a new high you observe 10 bars with a lower high. This really does not make sense as a condition to enter long. Also, it would be enough to write

 
Code
if (MAX(High, 11)[0] > MAX(High, 10)[0])
to trigger that same entry. The first condition will just trigger additional entries with each following bar that closes below the swing high.

I am sure that Jeffrey Katz did not specify any such condition. Best you point us directly to the source of your wisdom, so that we can find out, what he really meant.


Reply With Quote
  #5 (permalink)
Kush
San Sebastian/Spain
 
Posts: 12 since Sep 2011
Thanks Given: 0
Thanks Received: 1

It is explain in the page of 261 of the book The Encyclopedia of Trading Strategies:

If a new 50-day high has ocurred within the last 10 days, then True, else False. Instead True, it can be Buy

I don't know how can I programm this????


Reply With Quote
  #6 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


Kush View Post
It is explain in the page of 261 of the book The Encyclopedia of Trading Strategies:

If a new 50-day high has ocurred within the last 10 days, then True, else False. Instead True, it can be Buy

I don't know how can I programm this????

Katz/McCormick used that condition for one of the rules for a genetic optimizer. It is not an entry condition but a trendfilter.

The code in NinjaTrader would look like this:

 
Code
private bool rule_6 = false;
for (int i=0; i < 10;  i++)
{
     if ( High[i]  ==  MAX(High, 50)[i]
              rule_6 = true;
}


Reply With Quote
Thanked by:
  #7 (permalink)
Kush
San Sebastian/Spain
 
Posts: 12 since Sep 2011
Thanks Given: 0
Thanks Received: 1

Thank you for the explanation! Yes I found it in the chapter about Genetic Algorithms.


Thank you.


Reply With Quote




Last Updated on September 12, 2011


© 2026 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 - Downloads - Top
no new posts