4 green bars followed by a very long one

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11943 quote
    Stratus6
    Participant
    Junior

    I’d be really grateful for any assistance as to why this simple code doesn’t work. Above is a screen shot of the eur/usd showing 4 green bars followed by a very long one. All I want the code to do is detect 3 consecutive green bars – the final one of which is a large multiple of the one before – e.g. 5x then sell. Thanks all Linden

    c1 = (Close[1] - Open[1]) > 5*(Close[2] - Open[2])
    c2 = (Close[3]) > Open[3] )
    IF c1 and c2 THEN SELLSHORT 1 lot at market
    
    endif
    screen-shot-at-14712708204plc81.png screen-shot-at-14712708204plc81.png
    #11954 quote
    Nicolas
    Keymaster
    Master

    Hi stratus,

    Not tested, but it would operate properly I believe:

     

    c1 = summation[4](close>open)=4
    c2 = range>range[1]*5
    
    if c1 and c2 then 
     SELLSHORT 1 LOT AT MARKET 
    endif
    Wing thanked this post
    #32112 quote
    Stratus6
    Participant
    Junior

    Many thanks Nicolas, this works well.

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

4 green bars followed by a very long one


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Stratus6 @stratus6 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Stratus6
8 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/20/2016
Status: Active
Attachments: 1 files
Logo Logo
Loading...