Multiple entries

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #78517 quote
    Robert EquiziRobert Equizi
    Participant
    New

    This is my strategy:

    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    IF c2 THEN
    SELL AT MARKET
    ENDIF
    
    IF c3 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    IF c4 THEN
    EXITSHORT AT MARKET
    ENDIF

    Can someone please code the following:

    If c2 is not met, I want c1 to keep buying 1 contract at 50 point intervals until c2 is met e.g whether it buys 1 or 10 times

    And the same with selling

    If c4 is not met, i want c3 to keep selling short at 50 point intervals until c3 is met.

    Thank you,

    Rob

    #78526 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    To write code, please use the <> “insert PRT code” button yo make code easier to read and understand.

    I moved your topic to the english forum, instead of the french one, since you used english.

    #78527 quote
    VonasiVonasi
    Moderator
    Master

    You seem to be asking the same question in two different topics. Did my answer here not do what you requested?

    programming moving average & multiple entries

    Please try not to double post as it just results in confusion for everyone.

    #78528 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I don’t know whether Vonasi’s answer in the other post was what you were looking for, but I wrote something while Vonasi was typting and I’m posting it:

    FastAvg = average[20,0](close)
    SlowAvg = average[100,0](close)
    c1 = FastAvg > SlowAvg
    c2 = FastAvg CROSSES UNDER SlowAvg
    c3 = FastAvg < SlowAvg
    c4 = FastAvg CROSSES UNDER SlowAvg
    
    ONCE Treshold = 50 * pipsize
    IF Not OnMarket THEN
       MyPrice = 0
       TradeON = 1
    ELSIF OnMarket AND MyPrice = 0 THEN
       MyPrice = TRADEPRICE
    ENDIF
    
    IF LongOnMarket THEN
       TradeON = 0
       x = close - MyPrice
       IF x > Treshold THEN
          TradeON = 1
          MyPrice = MyPrice + Treshold
       ENDIF
    ENDIF
    IF c1 AND TradeON THEN
       BUY 1 CONTRACT AT MARKET
    ENDIF
    IF c2 THEN
       SELL AT MARKET
    ENDIF
    
    IF ShortOnMarket THEN
       TradeON = 0
       x = MyPrice - close
       IF x > Treshold THEN
          TradeON = 1
          MyPrice = MyPrice - Treshold
       ENDIF
    ENDIF
    IF c3 AND TradeON THEN
       SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    IF c4 THEN
       EXITSHORT AT MARKET
    ENDIF
    graph tradeprice
    graph MyPrice
    graph close
    graph treshold
    graph TradeON
    Nicolas thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Multiple entries


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by robertogozzirobertogozzi
8 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/18/2018
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...