code to at least one of multiple conditions

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #128440 quote
    steynpj
    Participant
    Average

    I need code to trade if ALL three conditions are met, c1, c2 and c3 and AT LEAST one of rest, c4-c14.

    Currently:

    IF c1 AND c2 AND c3 OR c4 OR c5 OR c6 OR c7 OR c8 OR c9 OR c10 OR c11 OR c12 OR c13 OR c14 THEN
    BUY 1 CONTRACT AT MARKET

    Which not correct.

    IF c1 AND c2 AND c3 AND ANY OF (c4 OR c5 OR c6 OR c7 OR c8 OR c9 OR c10 OR c11 OR c12 OR c13 OR c14) THEN
    BUY 1 CONTRACT AT MARKET

    What is correct code for my added bold code to get result?

     

    Thank you

    #128442 quote
    Nicolas
    Keymaster
    Master

    Your “c” conditions are boolean and return 1 if true. So a simple addition would do the trick:

    IF c1 AND c2 AND c3 AND (c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14)>0 THEN
     BUY 1 CONTRACT AT MARKET
    ENDIF
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

code to at least one of multiple conditions


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
steynpj @steynpj Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/27/2020
Status: Active
Attachments: No files
Logo Logo
Loading...