NexusFi: Find Your Edge


Home Menu

 





Hammer script


Discussion in NinjaTrader

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




 
Search this Thread

Hammer script

  #1 (permalink)
 zebidee 
London
 
Experience: Intermediate
Platform: Ninjatrader, T4
Trading: Nasdaq
Posts: 5 since Feb 2013
Thanks Given: 1
Thanks Received: 0

Hi all

I am new to Ninjascript and trying to create a really basic script based around price action, but the script doesn't execute. The idea is simply to trigger a long trade on a hammer candlestick formation. Ideally, I would like to add a bullish engulfing/morning star to this on the same basis. This is what I have:

{
SetProfitTarget("", CalculationMode.Ticks, 42);

CalculateOnBarClose = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Close[0] + 5 * TickSize > Low[0]
&& ToTime(Time[0]) >= ToTime(8, 0, 0)
&& ToTime(Time[0]) <= ToTime(17, 0, 0))
{
EnterLong(1, "");
}

}

thanks for any help

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
Exit Strategy
NinjaTrader
Are there any eval firms that allow you to sink to your …
Traders Hideout
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
GFIs1 1 DAX trade per day journal
22 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
19 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


Try in adding a Print() to see what are the values of your conditions:

 
Code
                            
Print("C: "Close[0] + TickSize+" Low: "Low[0] + " T1: "ToTime(Time[0]).toString() .... 

If you never execute the EnterLong(), it's because your conditions are never met...

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #4 (permalink)
 zebidee 
London
 
Experience: Intermediate
Platform: Ninjatrader, T4
Trading: Nasdaq
Posts: 5 since Feb 2013
Thanks Given: 1
Thanks Received: 0

Thanks for that. I'm afraid I'm pretty much limited to using the wizard and got an error when I tried to add that code. But, I have compiled a new script to enter long when the high is 1 tick above the low and it doesn't, so there seems to be something else wrong. Other scripts are executing fine.

Started this thread Reply With Quote




Last Updated on February 27, 2013


© 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