NexusFi: Find Your Edge


Home Menu

 





Simple 30M Bar Strategy Won't Go


Discussion in NinjaTrader

Updated
    1. trending_up 2,874 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?
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
Warsh Opens Today, Hormuz June 19 -- WTI Below $80, Fran …
Prediction Markets & Event Contracts
Would a node-based workflow for automated trading be useful?
Traders Hideout
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,758 since Jun 2009
Thanks Given: 3,828
Thanks Received: 4,644


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