Price greater or less than opening bar

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

    Hello

     

    I’m sorry if this seems obvious but I have tried many ways that seemed logical but don’t work – for me!

    Can anyone help please?

    When a signal is received the size and colour of the first bar is noted … then if the bar is green and CLOSE of any of the following bars is higher a BUY is activated or if the first bar is red and the CLOSE of any of the following bars is lower a SELLSHORT is activated.

    Each bar to the next signal is checked against the first bar of the run and if none meet the criteria the cycle starts over the next time the signal is triggered – and a new ‘first bar’ is established.

    I have tried setting an upper or lower variable against the value of the first bar and testing with greater/equal or lower/equal or crosses over/crosses under but I must be missing something ???

    Thanks

    #201782 quote
    robertogozzi
    Moderator
    Master

    There you go:

    ONCE LongEntry  = 0
    ONCE ShortEntry = 0
    Green = close > open
    Red   = close < Open
    MySignal = ...........
    IF MySignal AND Not OnMarket THEN
       IF Green THEN
          LongEntry  = close
          ShortEntry = 0
       ELSIF Red THEN
          LongEntry  = 0
          ShortEntry = close
       ENDIF
    ENDIF
    IF OnMarket THEN
       LongEntry  = 0
       ShortEntry = 0
    ENDIF
    IF LongEntry AND (close > LongEntry) THEN
       BUY 1 CONTRACT AT MARKET
       LongEntry  = 0
       ShortEntry = 0
    ELSIF ShortEntry AND (close < ShortEntry) THEN
       SELLSHORT 1 CONTRACT AT MARKET
       LongEntry  = 0
       ShortEntry = 0
    ENDIF
    SET STOP   pLOSS   150
    SET TARGET pPROFIT 300

    in line 5 you will need to define what MySignal is.

    #201791 quote
    maleczek
    Participant
    Junior

    Thank you Roberto

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

Price greater or less than opening bar


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
maleczek @maleczek Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by maleczek
3 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/02/2022
Status: Active
Attachments: No files
Logo Logo
Loading...