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 burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,983 views
    3 likes
    Last Post jhudas88  
    Working...
    X