NexusFi: Find Your Edge


Home Menu

 





Simple 30M Bar Strategy Won't Go


Discussion in NinjaTrader

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




 
Search this Thread

Simple 30M Bar Strategy Won't Go

  #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: 844

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?
Better Renko Gaps
The Elite Circle
Are there any eval firms that allow you to sink to your …
Traders Hideout
Deepmoney LLM
Elite Quantitative GenAI/LLM
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
 
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


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)
Follow me on Twitter 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: 844


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


© 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