NexusFi: Find Your Edge


Home Menu

 





Hammer script


Discussion in NinjaTrader

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




 
Search this Thread
  #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?
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
Netherlands & Germany Surge as World Cup Field Narro …
Prediction Markets & Event Contracts
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
10 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,759 since Jun 2009
Thanks Given: 3,828
Thanks Received: 4,645


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)
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


© 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