NexusFi: Find Your Edge


Home Menu

 





Simple 30M Bar Strategy Won't Go


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 845

I am trying to code a simple 30 minute strategy I read about, which requires entry if certain conditions are true plus the price crosses above the prior bar's close for long or below it for short. It's failing on the CrossAbove and CrossBelow statements I am using. If I comment them out, it works, abeit incorrectly. Any help would be appreciated, thank you.
 
Code
                            
if (Low[0] <= Low[1]
&& 
Close[1] < Open[1]
&& 
CrossAbove(Close, Close, 1)
//&& (High[1]-Low[1])/TickSize > tHold)
{
EnterLong(1, "Long");
}
 
// Condition set 2
if (High[0] >= High[1]
&& 
Close[1] > Open[1]
&& 
CrossBelow(Close, Close, 1)
//&& (High[1]-Low[1])/TickSize > tHold)
{
EnterShort(1, "Short");
} 


Attached Files
Elite Membership required to download: Slingshot30M.zip
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My Rant with AMP Futures
Trading Reviews and Vendors
AI for Traders — Agents, Memory, Tools & Real-Worl …
Elite Quantitative GenAI/LLM
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
[WTS] ATAS Lifetime ULTRA license – EU buyers only – …
Platforms and Indicators
Building a free browser DOM/SMC simulator - need some ad …
Platforms and Indicators
 
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,779 since Jun 2009
Thanks Given: 3,840
Thanks Received: 4,709


You don't need to use CrossAbove(), and you don't use it like it must be used.
The arguments of CrossAbove are two dataseries, so, for example, the cross above a SMA(7) and a SMA(34) is:
 
Code
                            
CrossAbove(SMA(7), SMA(34), 1) 

If you want
Quoting 
the price crosses above the prior bar's close for long or below it for short.

it's, for Long:
 
Code
                            
if (Close[0] > Close[1]) 


Success requires no deodorant! (Sun Tzu)
Reply With Quote
Thanked by:
  #4 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 845


sam028 View Post
You don't need to use CrossAbove(), and you don't use it like it must be used.
The arguments of CrossAbove are two dataseries, so, for example, the cross above a SMA(7) and a SMA(34) is:
 
Code
                            
CrossAbove(SMA(7), SMA(34), 1) 

If you want it's, for Long:
 
Code
                            
if (Close[0] > Close[1]) 


That fixed it, thank you very much! You da man!


Started this thread Reply With Quote




Last Updated on October 23, 2010


© 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