Aks for Coding help : Buy when 6 out of 10 conditions are met

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #204058 quote
    JohnScher
    Participant
    Veteran

    Good day to you.
    I was asking if anyone here can help me out and code this.

    For example
    I have 10 conditions c1, c2,c3…c10.
    If 6 of these conditions are met I want to buy.

    This actually looks simple, but I can’t translate this into code.
    Can one of you do this for me?

    #204060 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    assuming your conditions are boolean (=1 when true, =0 when false), you can create your overall new boolean “6 out of 10” condition like this:

    atleast6 = (c1+c2+c3+c4+c5+c6+c7+c8+c9+c10 >=6)
    
    if atleast6 then
      buy... // your buy statement
      ...
    endif
    Midlanddave, JohnScher and TomHill thanked this post
    #204065 quote
    JohnScher
    Participant
    Veteran

    Please have a thank you from me

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

Aks for Coding help : Buy when 6 out of 10 conditions are met


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
JohnScher @johnscher Participant
Summary

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

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