Announcement

Collapse
No announcement yet.

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:	284
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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    72 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X