Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Pin Bar strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Pin Bar strategy

    Hello:
    I have this code to identify bearish Pin Bar and it is seems to be not working as expected.
    I am trying to place a short trade when the previous candle is a bearish Pin Bar and therefore using the 1 vs 0 in the code below.
    Please see attached screen shots where it placed the trade where previous bar is not a Pin bar.
    I am expecting trade to be placed where I have marked previous PIN bar with an yellow pointing arrow.
    Any help would be appreciated.

    Thank you.


    //Short Pin Bar
    double UpperWick = High[1] - Open[1];
    double LowerBody = Open[1] - Close[1];
    bool Short_Pin_Bar_Found = UpperWick > LowerBody;


    if (Short_Pin_Bar_Found)

    {
    EnterShort(Convert.ToInt32(DefaultQuantity), @"Sell");
    }​

    Click image for larger version

Name:	Screenshot 2024-02-24 154154.png
Views:	74
Size:	46.8 KB
ID:	1292969

    #2
    Hello mtamaku,

    Thanks for your post.

    I see you have posted in the Indicator Development section of the Forums but your question is about a strategy. Is that correct?

    I have moved the forum thread to the Strategy Development section of the Forums since your questions seem to be about a custom strategy. Please let me know if this is incorrect.

    That said, have you added debugging prints to your script to understand exactly how the script's logic is behaving?

    To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

    Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.


    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by StockTrader88, 03-06-2021, 08:58 AM
    45 responses
    3,992 views
    3 likes
    Last Post johntraderuser2  
    Started by TAJTrades, Today, 09:46 AM
    0 responses
    7 views
    0 likes
    Last Post TAJTrades  
    Started by rhyminkevin, Yesterday, 04:58 PM
    5 responses
    62 views
    0 likes
    Last Post dp8282
    by dp8282
     
    Started by realblubb, Today, 09:28 AM
    0 responses
    8 views
    0 likes
    Last Post realblubb  
    Started by AaronKoRn, Yesterday, 09:49 PM
    1 response
    19 views
    0 likes
    Last Post Rikazkhan007  
    Working...
    X