﻿<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">
    <statement name="SUBMARKET">
      <block type="market" id="%~R%q?dP+SY|Q#I~{oVF">
        <field name="MARKET_LIST">forex</field>
        <field name="SUBMARKET_LIST">major_pairs</field>
        <field name="SYMBOL_LIST">frxEURUSD</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="DURATIONTYPE_LIST">m</field>
        <field name="PAYOUTTYPE_LIST">stake</field>
        <field name="CURRENCY_LIST">USD</field>
        <field name="RESTARTONERROR">FALSE</field>
        <value name="DURATION">
          <block type="math_number" id="sxYl%U5{t^F,Mj-zA7M5">
            <field name="NUM">1</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="294">
    <statement name="BEFOREPURCHASE_STACK">
      <block type="variables_set" id="ry}z$O:5@%jm4X^|;Nj+">
        <field name="VAR">RSI</field>
        <value name="VALUE">
          <block type="rsi" id="0Uvc#1Wn*a]z)j+@i=+o">
            <value name="INPUT">
              <block type="ohlc_values" id="rIBp8_)j@5[7`vj{3:;2">
                <field name="OHLCFIELD_LIST">close</field>
              </block>
            </value>
            <value name="PERIOD">
              <block type="math_number" id="!v{Er?LQo*8}2h5T0oI=">
                <field name="NUM">14</field>
              </block>
            </value>
          </block>
        </value>
        <next>
          <block type="controls_if" id="~W9g@rq!6CS0j~:;,srq">
            <value name="IF0">
              <block type="logic_compare" id="fCvD.FVN2)8M,eDcqXS2">
                <field name="OP">GT</field>
                <value name="A">
                  <block type="variables_get" id="3SB%|A2T~}pTCsSqIN6n">
                    <field name="VAR">RSI</field>
                  </block>
                </value>
                <value name="B">
                  <block type="math_number" id="U=wmE!WSha|jDDupEU2p">
                    <field name="NUM">60</field>
                  </block>
                </value>
              </block>
            </value>
            <statement name="DO0">
              <block type="controls_if" id="[W-D1]z(K8nflDkdcdj$">
                <value name="IF0">
                  <block type="logic_operation" id="KrXs,Z|kmscuW)H_9CyK">
                    <field name="OP">AND</field>
                    <value name="A">
                      <block type="logic_operation" id="^af+[%)s*C[+cU:!h8$M">
                        <field name="OP">AND</field>
                        <value name="A">
                          <block type="is_candle_black" id="ONt{]:sQv0[]g%0_/iky">
                            <value name="OHLCOBJ">
                              <block type="get_ohlc" id="4Ycn3[Z=(raM?l~@%*Bq">
                                <value name="CANDLEINDEX">
                                  <block type="math_number" id="9gI-uYZ_X-T;b-e8K*i7">
                                    <field name="NUM">1</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                          </block>
                        </value>
                        <value name="B">
                          <block type="is_candle_black" id="0_u~5G}6L5h^f!-Wu-QI">
                            <value name="OHLCOBJ">
                              <block type="get_ohlc" id="tj4?3L[@Hqi$8I;rRamp">
                                <value name="CANDLEINDEX">
                                  <block type="math_number" id="8*gh+.a~NI}ygnsC9F=w">
                                    <field name="NUM">2</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                          </block>
                        </value>
                      </block>
                    </value>
                    <value name="B">
                      <block type="is_candle_black" id="eWx,_#7UnQBr0EO4NHPT">
                        <value name="OHLCOBJ">
                          <block type="get_ohlc" id="hAVZt(w%|DT@=Bi}0#=8">
                            <value name="CANDLEINDEX">
                              <block type="math_number" id="JDafU!1/=8xi;.w%PXfd">
                                <field name="NUM">3</field>
                              </block>
                            </value>
                          </block>
                        </value>
                      </block>
                    </value>
                  </block>
                </value>
                <statement name="DO0">
                  <block type="purchase" id="h^)![I?*_uJdvJ[=w83G">
                    <field name="PURCHASE_LIST">PUT</field>
                  </block>
                </statement>
              </block>
            </statement>
            <next>
              <block type="controls_if" id=":yYop5?g5JLt%~JAC_s8">
                <value name="IF0">
                  <block type="logic_compare" id="sMT2X!X^-8~O5b(0AnZ1">
                    <field name="OP">LT</field>
                    <value name="A">
                      <block type="variables_get" id="7O0P~wzMD}y7gTE:_rmu">
                        <field name="VAR">RSI</field>
                      </block>
                    </value>
                    <value name="B">
                      <block type="math_number" id=")BM66U5:@+(sawT$z(BP">
                        <field name="NUM">40</field>
                      </block>
                    </value>
                  </block>
                </value>
                <statement name="DO0">
                  <block type="controls_if" id="))w0]y:uux7`2!2mrq7R">
                    <value name="IF0">
                      <block type="logic_operation" id="Bn`n)Nt@+^o.-]QR6+qv">
                        <field name="OP">AND</field>
                        <value name="A">
                          <block type="logic_operation" id="bj-CE0ydOwY}s`!tm2!1">
                            <field name="OP">AND</field>
                            <value name="A">
                              <block type="logic_negate" id="h;+GWN2ySS|p2]I}v%Hw">
                                <value name="BOOL">
                                  <block type="is_candle_black" id="r!KB_B(bTvG!/7OeCjMW">
                                    <value name="OHLCOBJ">
                                      <block type="get_ohlc" id="A)fX@FZ2]_)u=KP#Rekx">
                                        <value name="CANDLEINDEX">
                                          <block type="math_number" id="8l@@90G~?bz0hJPI[2b|">
                                            <field name="NUM">1</field>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <value name="B">
                              <block type="logic_negate" id="KTwyH~.TpYASmM02@(Q5">
                                <value name="BOOL">
                                  <block type="is_candle_black" id=":gG%aFK%hg:H`ygw62O%">
                                    <value name="OHLCOBJ">
                                      <block type="get_ohlc" id="R3Pb+mCl%h~BUfPu0mxf">
                                        <value name="CANDLEINDEX">
                                          <block type="math_number" id="3iq_)Kk4e#Q}[:,X#Z,l">
                                            <field name="NUM">2</field>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </value>
                          </block>
                        </value>
                        <value name="B">
                          <block type="logic_negate" id="LGO-M=#fCoc@=$YYv[is">
                            <value name="BOOL">
                              <block type="is_candle_black" id="1#hl$gHe#CrR))y3s.@g">
                                <value name="OHLCOBJ">
                                  <block type="get_ohlc" id="@*yG%oQu)suiAmuSo+Dv">
                                    <value name="CANDLEINDEX">
                                      <block type="math_number" id="W*4zasH0G.gVjtBStqlG">
                                        <field name="NUM">3</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </value>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="purchase" id=";0#($hXn6iCNclb0XXJS">
                        <field name="PURCHASE_LIST">CALL</field>
                      </block>
                    </statement>
                  </block>
                </statement>
              </block>
            </next>
          </block>
        </next>
      </block>
    </statement>
  </block>
  <block type="after_purchase" id="X[gun7Sx6Shn3kldC}mZ" x="1" y="720">
    <statement name="AFTERPURCHASE_STACK">
      <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="trade_again" id=",VG2~pX|wvNj6hMyw=%~"></block>
        </statement>
      </block>
    </statement>
  </block>
</xml>