NexusFi: Find Your Edge


Home Menu

 





Simple 30M Bar Strategy Won't Go


Discussion in NinjaTrader

Updated
    1. trending_up 2,936 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(CloseClose1)
//&& (High[1]-Low[1])/TickSize > tHold)
{
EnterLong(1"Long");
}
 
// Condition set 2
if (High[0] >= High[1]
&& 
Close[1] > Open[1]
&& 
CrossBelow(CloseClose1)
//&& (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?
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
Datafeed for Atas
Platforms and Indicators
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
Thanks Mike. Godspeed.
The Elite Circle
Daytrading to swingtrading
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Want your NinjaTrader indicator created, free?
5 thanks
Denied 20K payouts: Alpha Futures
1 thanks
FootPrintV2 Chart for NT8
1 thanks
BERN ALGOS algo trading journal
1 thanks
Afternoon-close session
1 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,767 since Jun 2009
Thanks Given: 3,836
Thanks Received: 4,690


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