Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding Candle Close Strategy

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

    Adding Candle Close Strategy

    I have a functioning code that uses this type of format. I have a bunch of parameters that all need to be true at the same time for an entry, so I am thinking of adding this in to test a theory I have been thinking for my scalp trades. This would be looking at entering a short looking for a continuation with my other parameters. Is there a way for me to do this shorthand and have the ability to create an extra variable that allows me to test the previous certain number of candles or do they have to be written out each time. It's obviously not too difficult to add another Close[x+?]<Close[x+?] just looking to simplify my replay tests.

    && (EntryCandleDirection ? (Close[x] < Close[x+1] && Close[x+1] <Close[x+2] && Close[x+2] < Close[x+3] && Close[x+3] < Close[x+4] && Close[x+4] < Close[x+5] && Close[x+5] < Close[x+6] && Close[x+6] < v[x+7]&& Close[x+7] < Close[x+8]&& Close[x+8] < Close[x+9]) : Close[0] > 0)​

    #2
    Hi durdcash, thanks for posting. The code here can be placed inside it's own method that returns a boolean e.g.

    private bool MyBoolVariable()
    {
    return ((EntryCandleDirection ? (Close[x] < Close[x+1] && Close[x+1] <Close[x+2] && Close[x+2] < Close[x+3] && Close[x+3] < Close[x+4] && Close[x+4] < Close[x+5] && Close[x+5] < Close[x+6] && Close[x+6] < v[x+7]&& Close[x+7] < Close[x+8]&& Close[x+8] < Close[x+9]) : Close[0] > 0)​);
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X