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
    JohnScherJohnScher
    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_BywanJC_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
    JohnScherJohnScher
    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.
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

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 JohnScherJohnScher
3 years, 10 months ago.

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