Multiple conditions on a single BAR and STOPs

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #31728 quote
    robertogozzi
    Moderator
    Master

    With this strategy:

    DEFPARAM CumulateOrders = false
    
    IF close > open THEN
       BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    IF Macd[12,26,9](close) > 0 THEN
       SET TARGET pPROFIT  30
       SET STOP   pLOSS    15
       BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    SET TARGET pPROFIT  20
    SET STOP   pLOSS    10
    

    (1) –  both conditions are true within the SAME bar, does ProOrder enters only 1 trade or 2, despite

    DEFPARAM CumulateOrders = false

    ?

    (2) – if and when the first condition is true, do SL and TP are set according to the two last lines, despite they are set before within

    IF ... ENDIF

    ?

    Thanks.

    #31730 quote
    Nicolas
    Keymaster
    Master

    Remember that code is read from top to bottom, so it will only be the first condition to be true that will launch the only one allowed trade by CumulateOrders=false.

    About your point ‘2), sorry I don’t understand. If the set stop and set target are written at the bottom of the code, without been nested into a conditional statement, they will be read and executed by the server for the order launched some lines before.. Am I clear? 🙂

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

Multiple conditions on a single BAR and STOPs


ProOrder support

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
8 years, 9 months ago.

Topic Details
Forum: ProOrder support
Language: English
Started: 04/11/2017
Status: Active
Attachments: No files
Logo Logo
Loading...