Hello,
I have a EURGBP trading strategy programmed in the MarketMaker platform of the Broker CMC and I would like to ask somebody with good knowledge about MT4 programming to program it.
Basically, the strategy works only (as far as I have tested) with the EURGBP pair.
Time frame is 2 hours (possible difficulties). I have noticed until now that in 4h it also works acceptably but in 1h time frame is not good enough. 2h is the best so the data bars in MT4 need to be converted for processing purposes into 2h bars.
It uses one single indicator: Stochastic Momentum Index (14,3,5,3) which is not a standard indicator in MT4.
The strategy has multiple entries when the price initially moves against the trade but only when the price has moved at least 20 pips from first entry (for second entry), at least 40 pips from first entry (for third entry) and so on.
It enter one lot in the first, second and third entries. In the case of the rare fourth entry, it adds three lots.
The code in MarketMaker is the following (I believe that anybody with programing experience in MT4 will understand it easily):
----------------------------------------------
a = -40
b = 40
REM Stochastic Momentum Index indicator
indicator1 = SMI[14,3,5](close)
REM Buy: indicator below over-sold threshold and rising
c1 = (indicator1 < a) and (indicator1[1] < indicator1)
IF c1 THEN
if longonmarket then
yy = 0
rem Second entry
if COUNTOFLONGSHARES = 10000 then
yy = close < (ENTRYQUOTE - 0.0020)
if yy then
BUY 10000 shares AT MARKET THISBARONCLOSE
endif
elsif COUNTOFLONGSHARES = 20000 then
yy = close < (ENTRYQUOTE - 0.0040)
if yy then
BUY 10000 shares AT MARKET THISBARONCLOSE
endif
elsif COUNTOFLONGSHARES = 30000 then
yy = close < (ENTRYQUOTE - 0.0060)
if yy then
BUY 30000 shares AT MARKET THISBARONCLOSE
endif
endif
else
rem First entry
BUY 10000 shares AT MARKET THISBARONCLOSE
endif
ENDIF
REM Sell: indicator above over-bought threshold or 80 pips stop has been touched (stop is common to all entries)
c2 = (indicator1 >= b) or (close < ENTRYQUOTE - 0.0079)
IF c2 THEN
SELL AT MARKET THISBARONCLOSE
ENDIF
REM Short selling: : indicator above over-bought threshold and dropping
c3 = (indicator1 > b) and (indicator1[1] > indicator1)
IF c3 THEN
if shortonmarket then
yy = 0
if COUNTOFshortSHARES = 10000 then
yy = close > (ENTRYQUOTE + 0.0020)
if yy then
sellshort 10000 shares AT MARKET THISBARONCLOSE
endif
elsif COUNTOFshortSHARES = 20000 then
yy = close > (ENTRYQUOTE + 0.0040)
if yy then
sellshort 10000 shares AT MARKET THISBARONCLOSE
endif
elsif COUNTOFshortSHARES = 30000 then
yy = close > (ENTRYQUOTE + 0.0060)
if yy then
sellshort 30000 shares AT MARKET THISBARONCLOSE
endif
endif
else
sellshort 10000 shares AT MARKET THISBARONCLOSE
endif
endif
REM Exit short: indicator below over sold threshold
c4 = (indicator1 <= a) or (close > ENTRYQUOTE + 0.0079)
IF c4 THEN
EXITSHORT AT MARKET THISBARONCLOSE
ENDIF
----------------------------------------------------------------
Can anybody help? Questions welcome.
Thank you very much.
I have a EURGBP trading strategy programmed in the MarketMaker platform of the Broker CMC and I would like to ask somebody with good knowledge about MT4 programming to program it.
Basically, the strategy works only (as far as I have tested) with the EURGBP pair.
Time frame is 2 hours (possible difficulties). I have noticed until now that in 4h it also works acceptably but in 1h time frame is not good enough. 2h is the best so the data bars in MT4 need to be converted for processing purposes into 2h bars.
It uses one single indicator: Stochastic Momentum Index (14,3,5,3) which is not a standard indicator in MT4.
The strategy has multiple entries when the price initially moves against the trade but only when the price has moved at least 20 pips from first entry (for second entry), at least 40 pips from first entry (for third entry) and so on.
It enter one lot in the first, second and third entries. In the case of the rare fourth entry, it adds three lots.
The code in MarketMaker is the following (I believe that anybody with programing experience in MT4 will understand it easily):
----------------------------------------------
a = -40
b = 40
REM Stochastic Momentum Index indicator
indicator1 = SMI[14,3,5](close)
REM Buy: indicator below over-sold threshold and rising
c1 = (indicator1 < a) and (indicator1[1] < indicator1)
IF c1 THEN
if longonmarket then
yy = 0
rem Second entry
if COUNTOFLONGSHARES = 10000 then
yy = close < (ENTRYQUOTE - 0.0020)
if yy then
BUY 10000 shares AT MARKET THISBARONCLOSE
endif
elsif COUNTOFLONGSHARES = 20000 then
yy = close < (ENTRYQUOTE - 0.0040)
if yy then
BUY 10000 shares AT MARKET THISBARONCLOSE
endif
elsif COUNTOFLONGSHARES = 30000 then
yy = close < (ENTRYQUOTE - 0.0060)
if yy then
BUY 30000 shares AT MARKET THISBARONCLOSE
endif
endif
else
rem First entry
BUY 10000 shares AT MARKET THISBARONCLOSE
endif
ENDIF
REM Sell: indicator above over-bought threshold or 80 pips stop has been touched (stop is common to all entries)
c2 = (indicator1 >= b) or (close < ENTRYQUOTE - 0.0079)
IF c2 THEN
SELL AT MARKET THISBARONCLOSE
ENDIF
REM Short selling: : indicator above over-bought threshold and dropping
c3 = (indicator1 > b) and (indicator1[1] > indicator1)
IF c3 THEN
if shortonmarket then
yy = 0
if COUNTOFshortSHARES = 10000 then
yy = close > (ENTRYQUOTE + 0.0020)
if yy then
sellshort 10000 shares AT MARKET THISBARONCLOSE
endif
elsif COUNTOFshortSHARES = 20000 then
yy = close > (ENTRYQUOTE + 0.0040)
if yy then
sellshort 10000 shares AT MARKET THISBARONCLOSE
endif
elsif COUNTOFshortSHARES = 30000 then
yy = close > (ENTRYQUOTE + 0.0060)
if yy then
sellshort 30000 shares AT MARKET THISBARONCLOSE
endif
endif
else
sellshort 10000 shares AT MARKET THISBARONCLOSE
endif
endif
REM Exit short: indicator below over sold threshold
c4 = (indicator1 <= a) or (close > ENTRYQUOTE + 0.0079)
IF c4 THEN
EXITSHORT AT MARKET THISBARONCLOSE
ENDIF
----------------------------------------------------------------
Can anybody help? Questions welcome.
Thank you very much.