﻿<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="variables_set" x="30" y="19">
    <field name="VAR">Next Trade Condition</field>
    <value name="VALUE">
      <block type="text">
        <field name="TEXT">Even</field>
      </block>
    </value>
    <next>
      <block type="variables_set">
        <field name="VAR">Max Acceptable Loss</field>
        <value name="VALUE">
          <block type="math_number">
            <field name="NUM">1000</field>
          </block>
        </value>
        <next>
          <block type="variables_set">
            <field name="VAR">Expected Profit</field>
            <value name="VALUE">
              <block type="math_number">
                <field name="NUM">100</field>
              </block>
            </value>
            <next>
              <block type="variables_set">
                <field name="VAR">Win Amount</field>
                <value name="VALUE">
                  <block type="math_number">
                    <field name="NUM">20</field>
                  </block>
                </value>
                <next>
                  <block type="variables_set">
                    <field name="VAR">Initial Amount</field>
                    <value name="VALUE">
                      <block type="math_number">
                        <field name="NUM">20</field>
                      </block>
                    </value>
                    <next>
                      <block type="trade" id="trade" deletable="false">
                        <statement name="SUBMARKET">
                          <block type="r_100">
                            <statement name="CONDITION">
                              <block type="evenodd">
                                <field name="PAYOUTTYPE_LIST">stake</field>
                                <field name="CURRENCY_LIST">USD</field>
                                <value name="DURATION">
                                  <block type="math_number">
                                    <field name="NUM">5</field>
                                  </block>
                                </value>
                                <value name="AMOUNT">
                                  <block type="variables_get">
                                    <field name="VAR">Initial Amount</field>
                                  </block>
                                </value>
                              </block>
                            </statement>
                          </block>
                        </statement>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </next>
      </block>
    </next>
  </block>
  <block type="on_strategy" id="strategy" deletable="false" x="395" y="16">
    <statement name="STRATEGY_STACK">
      <block type="controls_if">
        <mutation else="1"></mutation>
        <value name="IF0">
          <block type="logic_compare">
            <field name="OP">EQ</field>
            <value name="A">
              <block type="variables_get">
                <field name="VAR">Next Trade Condition</field>
              </block>
            </value>
            <value name="B">
              <block type="text">
                <field name="TEXT">Even</field>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO0">
          <block type="purchase">
            <field name="PURCHASE_LIST">DIGITEVEN</field>
          </block>
        </statement>
        <statement name="ELSE">
          <block type="purchase">
            <field name="PURCHASE_LIST">DIGITODD</field>
          </block>
        </statement>
      </block>
    </statement>
  </block>
  <block type="on_finish" id="finish" deletable="false" x="396" y="173">
    <statement name="FINISH_STACK">
      <block type="controls_if">
        <mutation else="1"></mutation>
        <value name="IF0">
          <block type="contract_check_result">
            <field name="CHECK_RESULT">win</field>
          </block>
        </value>
        <statement name="DO0">
          <block type="notify">
            <field name="NOTIFICATION_TYPE">success</field>
            <value name="MESSAGE">
              <block type="text_join">
                <mutation items="2"></mutation>
                <value name="ADD0">
                  <block type="text">
                    <field name="TEXT">Won:</field>
                  </block>
                </value>
                <value name="ADD1">
                  <block type="read_details">
                    <field name="DETAIL_INDEX">4</field>
                  </block>
                </value>
              </block>
            </value>
            <next>
              <block type="variables_set">
                <field name="VAR">Initial Amount</field>
                <value name="VALUE">
                  <block type="variables_get">
                    <field name="VAR">Win Amount</field>
                  </block>
                </value>
                <next>
                  <block type="controls_if">
                    <mutation else="1"></mutation>
                    <value name="IF0">
                      <block type="logic_compare">
                        <field name="OP">EQ</field>
                        <value name="A">
                          <block type="variables_get">
                            <field name="VAR">Next Trade Condition</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="text">
                            <field name="TEXT">Even</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="variables_set">
                        <field name="VAR">Next Trade Condition</field>
                        <value name="VALUE">
                          <block type="text">
                            <field name="TEXT">Odd</field>
                          </block>
                        </value>
                      </block>
                    </statement>
                    <statement name="ELSE">
                      <block type="variables_set">
                        <field name="VAR">Next Trade Condition</field>
                        <value name="VALUE">
                          <block type="text">
                            <field name="TEXT">Even</field>
                          </block>
                        </value>
                      </block>
                    </statement>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </statement>
        <statement name="ELSE">
          <block type="notify">
            <field name="NOTIFICATION_TYPE">warn</field>
            <value name="MESSAGE">
              <block type="text_join">
                <mutation items="2"></mutation>
                <value name="ADD0">
                  <block type="text">
                    <field name="TEXT">Lost: </field>
                  </block>
                </value>
                <value name="ADD1">
                  <block type="math_single">
                    <field name="OP">ABS</field>
                    <value name="NUM">
                      <shadow type="math_number" id="GleSn`9j7Cm7/dqg}FIA">
                        <field name="NUM">9</field>
                      </shadow>
                      <block type="read_details">
                        <field name="DETAIL_INDEX">4</field>
                      </block>
                    </value>
                  </block>
                </value>
              </block>
            </value>
            <next>
              <block type="math_change">
                <field name="VAR">Initial Amount</field>
                <value name="DELTA">
                  <shadow type="math_number" id="N=Vo^MVz~/^(xt7Ag@8E">
                    <field name="NUM">1</field>
                  </shadow>
                  <block type="math_arithmetic">
                    <field name="OP">MULTIPLY</field>
                    <value name="A">
                      <shadow type="math_number" id="ka8n8|Dugz,q5FkUjs`7">
                        <field name="NUM">1</field>
                      </shadow>
                      <block type="math_single">
                        <field name="OP">ABS</field>
                        <value name="NUM">
                          <shadow type="math_number" id="GleSn`9j7Cm7/dqg}FIA">
                            <field name="NUM">9</field>
                          </shadow>
                          <block type="read_details">
                            <field name="DETAIL_INDEX">4</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <value name="B">
                      <shadow type="math_number" id="{JXdZCp2%s=sfO@yN:n}">
                        <field name="NUM">1</field>
                      </shadow>
                      <block type="math_number">
                        <field name="NUM">1.041</field>
                      </block>
                    </value>
                  </block>
                </value>
              </block>
            </next>
          </block>
        </statement>
        <next>
          <block type="notify">
            <field name="NOTIFICATION_TYPE">info</field>
            <value name="MESSAGE">
              <block type="text_join">
                <mutation items="2"></mutation>
                <value name="ADD0">
                  <block type="text">
                    <field name="TEXT">Total Profit: </field>
                  </block>
                </value>
                <value name="ADD1">
                  <block type="total_profit"></block>
                </value>
              </block>
            </value>
            <next>
              <block type="controls_if">
                <mutation else="1"></mutation>
                <value name="IF0">
                  <block type="logic_compare">
                    <field name="OP">LT</field>
                    <value name="A">
                      <block type="total_profit"></block>
                    </value>
                    <value name="B">
                      <block type="variables_get">
                        <field name="VAR">Expected Profit</field>
                      </block>
                    </value>
                  </block>
                </value>
                <statement name="DO0">
                  <block type="controls_if">
                    <mutation else="1"></mutation>
                    <value name="IF0">
                      <block type="logic_operation">
                        <field name="OP">AND</field>
                        <value name="A">
                          <block type="math_number_property">
                            <mutation divisor_input="false"></mutation>
                            <field name="PROPERTY">NEGATIVE</field>
                            <value name="NUMBER_TO_CHECK">
                              <shadow type="math_number" id="otH_VG.6ad,:GnG=3=)5">
                                <field name="NUM">0</field>
                              </shadow>
                              <block type="total_profit"></block>
                            </value>
                          </block>
                        </value>
                        <value name="B">
                          <block type="logic_compare">
                            <field name="OP">GTE</field>
                            <value name="A">
                              <block type="math_single">
                                <field name="OP">ABS</field>
                                <value name="NUM">
                                  <shadow type="math_number" id="(UBCH+RQSwYPbgf%@ANZ">
                                    <field name="NUM">9</field>
                                  </shadow>
                                  <block type="total_profit"></block>
                                </value>
                              </block>
                            </value>
                            <value name="B">
                              <block type="variables_get">
                                <field name="VAR">Max Acceptable Loss</field>
                              </block>
                            </value>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="text_print">
                        <value name="TEXT">
                          <shadow type="text" id="Nau%l+%*hH!#y2I#Q@%5">
                            <field name="TEXT">abc</field>
                          </shadow>
                          <block type="text">
                            <field name="TEXT">Max Acceptable Loss Reached</field>
                          </block>
                        </value>
                      </block>
                    </statement>
                    <statement name="ELSE">
                      <block type="trade_again"></block>
                    </statement>
                  </block>
                </statement>
                <statement name="ELSE">
                  <block type="text_print">
                    <value name="TEXT">
                      <shadow type="text" id="kqlrIk.GO.^}hI,PoUV)">
                        <field name="TEXT">abc</field>
                      </shadow>
                      <block type="text_join">
                        <mutation items="2"></mutation>
                        <value name="ADD0">
                          <block type="text">
                            <field name="TEXT">Done! Total profit: </field>
                          </block>
                        </value>
                        <value name="ADD1">
                          <block type="total_profit"></block>
                        </value>
                      </block>
                    </value>
                  </block>
                </statement>
              </block>
            </next>
          </block>
        </next>
      </block>
    </statement>
  </block>
</xml>