Reset trade ok if above bollinger middle

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #107590 quote
    Crillezz
    Participant
    Veteran

    Hey! I need help with a code.

    For example.

    Buy if close is below bollinger low and the system stopped me out -20P.

    Now I do not want it to take more trades before it has reached bollinger middle first.

    Then it can start looking for a trade again if close is below bollingerband low.

     

    For example

    OK = 1

    OK = 0

    If c1 and Ok = 1 then

    buy 1contract at market.

    Namnlös.png Namnlös.png
    #107607 quote
    robertogozzi
    Moderator
    Master

    This will reenable trading after you had previously disabled it.

    Example with a 20-period BB:

    If low <= Average[20,0](close) Then
       Ok = 1
    Endif
    #107646 quote
    Crillezz
    Participant
    Veteran

    Thx Roberto.

    Not really what I was looking for.

    Here is a picture so it becomes easier to understand what I mean.

    Don’t know how to get OK to 0 and then reset to 1 again?

    fsdsdfsfsdfd.png fsdsdfsfsdfd.png
    #107655 quote
    robertogozzi
    Moderator
    Master

    So you don’t need to reset OK if above Bollinger middle, but also to clear it after a trade?

    Please post the code you have already written.

    #107720 quote
    jebus89
    Participant
    Master

    So in the first pic close is never above the boll middle after the first trade is done, so that actually dosnt make sense.

     

    You could use something like “highest[10](close) >  highest[10](average[20](close))

     

    someone please correct me if im wrong, but that would mean that for the past 10 bars (or whatever number you would use), price must have been above the moving average 20 (aka bollinger middle) But that would also mean that the “move” so to speak has to happen within XX bars, probably not exactly what you wanted but its at least a step in the right direction..

    #107782 quote
    Crillezz
    Participant
    Veteran

    If long and stopped then Ok should be 0.  Then the system cannot do any trade  because  OK=0.

    To reset OK to 1 again, the price must be up to bollinger middle.

    Then it is allowed to take a trade again. because OK=1.

     

    The idea is to avoid buying and buying and the price continues to fall.

    I want it to be normal conditions again before the system takes on a new trade.

    Hope it helps

    /Christian

    I think that everything is back to normal when the price went up to bollinger middle after a fall.

    dsadsadasd.png dsadsadasd.png
    #107786 quote
    Crillezz
    Participant
    Veteran

    Yes. but not just after a certain number. Price must be above bollinge middle

     

    So in the first pic close is never above the boll middle after the first trade is done, so that actually dosnt make sense.

     

    You could use something like “highest[10](close) >  highest[10](average[20](close))

     

    someone please correct me if im wrong, but that would mean that for the past 10 bars (or whatever number you would use), price must have been above the moving average 20 (aka bollinger middle) But that would also mean that the “move” so to speak has to happen within XX bars, probably not exactly what you wanted but its at least a step in the right direction..

    #107787 quote
    Crillezz
    Participant
    Veteran

    If long and stopped OK changes from 1 to 0.

    If Close > Avarage[20,0]Close Then

    OK=1

    #107792 quote
    robertogozzi
    Moderator
    Master

    Yes. but not just after a certain number. Price must be above bollinge middle

    So in the first pic close is never above the boll middle after the first trade is done, so that actually dosnt make sense.

    You could use something like “highest[10](close) > highest[10](average[20](close))

    someone please correct me if im wrong, but that would mean that for the past 10 bars (or whatever number you would use), price must have been above the moving average 20 (aka bollinger middle) But that would also mean that the “move” so to speak has to happen within XX bars, probably not exactly what you wanted but its at least a step in the right direction..

    No, what you want to achieve needs to be written, to just check that:

    summation[10](close) >  highest[10](average[20](close)) = 10

    to check that ALL last 10 bars CLOSE has always been > highest[10](average[20](close)).

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Reset trade ok if above bollinger middle


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Crillezz @crillezz Participant
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by robertogozzi
6 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/15/2019
Status: Active
Attachments: 3 files
Logo Logo
Loading...