Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

build a strategy of two successive candles

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

    build a strategy of two successive candles

    Hello,

    I want to build a strategy based on counting candles so my strategy is working like that “if I have two successive red candles and next candle is green I know we can’t tell if we are having a green candle but let say if the price reach the open of the first two red candle we are counting it should take an operation at that pointe
    my problem here that my orders are noting filled in the same pointe as the strategy should be
    and some times the strategy ignore the condition that is should counter two candles first

    Click image for larger version

Name:	GOEI.jpg
Views:	304
Size:	71.8 KB
ID:	1292050


    this a part of the code that driving me crazy over 9 month , I'm still learinng but i need help
    Click image for larger version

Name:	first-set.jpg
Views:	270
Size:	39.6 KB
ID:	1292051



    XD
    Click image for larger version

Name:	set-2.jpg
Views:	258
Size:	36.5 KB
ID:	1292052

    ​thank you so much for reading and any help will be appreciated

    #2
    Hello lafava7118,

    I think you are wanting to have all of this in one condition set and to be using Open bars ago 2 is greater than Close bars ago 2, Open bars ago 1 is greater than Close bars ago 1, and Close bars ago 0 is greater than or equal to Open bars ago 0 (or bars ago 1 if you want to compare to the previous bar).

    With Calculate.OnPriceChange the currently updating bar can be checked on each price change.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      hi ChelseaB​ thank you for your reply even so , i change everything in the same set it will take the order randomly and i need it to fire the order in the same Candel "green" and if it dont meet the conditions it should not make any actions
      # how can i make it take actions in the same next candle "Green"
      # How to ignore the other single till I exit the operation
      i tried to use Nbarup and Nbardown but it didn't work for me


      Click image for larger version

Name:	actions.jpg
Views:	260
Size:	64.4 KB
ID:	1292098

      Comment


        #4
        Hello lafava7118,

        The "Next" candle doesn't exist. You can only check the currently building (or most recently closed candle) and the previous candles.

        To check if the current candle is green, use Close[0] > Open[0].

        To check if the previous candle is red, use Close[1] < Open[1].

        To check if the second prior candle is red, use Close[2] < Open[2]/
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        51 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        127 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X