NexusFi: Find Your Edge


Home Menu

 





Hammer script


Discussion in NinjaTrader

Updated
    1. trending_up 2,381 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?
Iran Ceasefire Surges to 19.5% on US 15-Point Plan -- 82 …
Prediction Markets & Event Contracts
Penalties in Budapest, Peace Deadline in Tehran: Arsenal …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
Topstep Acquires The Futures Desk -- Prop Firm Consolida …
Funded Trading Evaluation Firms
Tradeify 3.0 Overhauls Futures Prop Firm Model -- One-Ti …
Funded Trading Evaluation Firms
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,756 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,632


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