<xml xmlns="http://www.w3.org/1999/xhtml" collection="false">
  <block type="loader" id="G8*bH0yYOiK7:XhZ-!pX" x="0" y="0">
    <field name="URL">https://gist.githubusercontent.com/aminmarashi/0feb52b5802519cd4157b612d9bd3471/raw/martingale.xml</field>
  </block>
  <block type="trade" id=")inu*9KBx=?O=ZEkmjl_" x="0" y="53">
    <field name="MARKET_LIST">volidx</field>
    <field name="SUBMARKET_LIST">random_index</field>
    <field name="SYMBOL_LIST">R_100</field>
    <field name="TRADETYPECAT_LIST">callput</field>
    <field name="TRADETYPE_LIST">risefall</field>
    <field name="TYPE_LIST">both</field>
    <field name="CANDLEINTERVAL_LIST">60</field>
    <field name="TIME_MACHINE_ENABLED">FALSE</field>
    <field name="RESTARTONERROR">TRUE</field>
    <statement name="INITIALIZATION">
      <block type="variables_set" id="D~h{1n*IvE,S7Q_Yhc#%">
        <field name="VAR">Number of lost trades</field>
        <value name="VALUE">
          <block type="math_number" id="BPJ!L2JjSjMHaKB61^H)">
            <field name="NUM">0</field>
          </block>
        </value>
        <next>
          <block type="variables_set" id="N_EXN0%,rs9:FKIqK+{;">
            <field name="VAR">Reset martingale after</field>
            <value name="VALUE">
              <block type="math_number" id="(TIo3V(B/ZqxMf3Ea3d{">
                <field name="NUM">5</field>
              </block>
            </value>
          </block>
        </next>
      </block>
    </statement>
    <statement name="SUBMARKET">
      <block type="tradeOptions" id="5[]aq]-2R`]a@=YGd%3]">
        <field name="DURATIONTYPE_LIST">t</field>
        <field name="CURRENCY_LIST">USD</field>
        <value name="DURATION">
          <block type="math_number" id="sxYl%U5{t^F,Mj-zA7M5">
            <field name="NUM">5</field>
          </block>
        </value>
        <value name="AMOUNT">
          <block type="procedures_callreturn" id="#+4O3V{hS-`.=f(Vye8_">
            <mutation name="Martingale Trade Amount"></mutation>
          </block>
        </value>
      </block>
    </statement>
  </block>
  <block type="before_purchase" id="*Q[~K|v:Sg)bHrl+VA1N" x="0" y="385">
    <statement name="BEFOREPURCHASE_STACK">
      <block type="purchase" id="Ot~~0{MHI(WEeSm{nTP4">
        <field name="PURCHASE_LIST">CALL</field>
      </block>
    </statement>
  </block>
  <block type="after_purchase" id="X[gun7Sx6Shn3kldC}mZ" x="0" y="475">
    <statement name="AFTERPURCHASE_STACK">
      <block type="controls_if" id="uW+`P;@!8/:k(n_bEJzW">
        <mutation else="1"></mutation>
        <value name="IF0">
          <block type="contract_check_result" id="$3Du|CS+?*Cg|hWs_hn~">
            <field name="CHECK_RESULT">win</field>
          </block>
        </value>
        <statement name="DO0">
          <block type="variables_set" id="k:1e-U|l%f73AMh3a=Ut">
            <field name="VAR">Number of lost trades</field>
            <value name="VALUE">
              <block type="math_number" id="0}}%:{::Br7WnQ]))v,l">
                <field name="NUM">0</field>
              </block>
            </value>
          </block>
        </statement>
        <statement name="ELSE">
          <block type="math_change" id="]E`s(QVUpu9D4u+D:T?i">
            <field name="VAR">Number of lost trades</field>
            <value name="DELTA">
              <shadow type="math_number" id="cniR1tyzRec0Qu%Cl+.Q">
                <field name="NUM">1</field>
              </shadow>
            </value>
          </block>
        </statement>
        <next>
          <block type="controls_if" id="#=yO.C1rn7n]Zw*%E1AI">
            <value name="IF0">
              <block type="procedures_callreturn" id=")5H0+av/lasc#QI6to2^">
                <mutation name="Martingale Trade Again After Purchase">
                  <arg name="martingale:profit"></arg>
                  <arg name="martingale:resultIsWin"></arg>
                </mutation>
                <value name="ARG0">
                  <block type="read_details" id="(E,!25pd^Ev`yMmr[z*_">
                    <field name="DETAIL_INDEX">4</field>
                  </block>
                </value>
                <value name="ARG1">
                  <block type="contract_check_result" id="^ShXafO+N,gqVXtl^w)e">
                    <field name="CHECK_RESULT">win</field>
                  </block>
                </value>
              </block>
            </value>
            <statement name="DO0">
              <block type="controls_if" id="i/tYUnQ.6y:q%!HRB:OT">
                <value name="IF0">
                  <block type="logic_compare" id="Ogq)lOdN-XeBi-88JNR,">
                    <field name="OP">GTE</field>
                    <value name="A">
                      <block type="variables_get" id="X1oORiCszyRsB4Qd@?oK">
                        <field name="VAR">Number of lost trades</field>
                      </block>
                    </value>
                    <value name="B">
                      <block type="variables_get" id="Hu^V*7{**8R*wE8,}SJv">
                        <field name="VAR">Reset martingale after</field>
                      </block>
                    </value>
                  </block>
                </value>
                <statement name="DO0">
                  <block type="variables_set" id="?*b$ZJ?+-hZV%H-q{Vk`">
                    <field name="VAR">Number of lost trades</field>
                    <value name="VALUE">
                      <block type="math_number" id="y)3#[Q(9alb`zz1oRv@X">
                        <field name="NUM">0</field>
                      </block>
                    </value>
                    <next>
                      <block type="variables_set" id="`Q(mI_JR={OqKCxMJu_Q">
                        <field name="VAR">martingale:size</field>
                        <value name="VALUE">
                          <block type="math_number" id="+HhgMFJKxyNHGtnu_-NB">
                            <field name="NUM">1</field>
                          </block>
                        </value>
                      </block>
                    </next>
                  </block>
                </statement>
                <next>
                  <block type="trade_again" id=",VG2~pX|wvNj6hMyw=%~"></block>
                </next>
              </block>
            </statement>
          </block>
        </next>
      </block>
    </statement>
  </block>
</xml>