0% found this document useful (0 votes)
329 views16 pages

XMT Scalper

This document describes an expert advisor called XMT-Scalper for the trading platform MetaTrader. It provides background on the development of the expert advisor and describes its usage, input settings, and trading settings. The input and trading settings can be adjusted to suit different trading environments and brokers.

Uploaded by

Tanuj Soni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
329 views16 pages

XMT Scalper

This document describes an expert advisor called XMT-Scalper for the trading platform MetaTrader. It provides background on the development of the expert advisor and describes its usage, input settings, and trading settings. The input and trading settings can be adjusted to suit different trading environments and brokers.

Uploaded by

Tanuj Soni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

1 | o f p a g e 1 6

XMT-Scalper

What is XMT-Scalper

XMT-Scalper is a robot (a computer program, also known as Expert
!"isor# or E# for s$ort% for t$e tra!ing platform MetaTra!er &'

(t)s originall* base! on an earl* "ersion of t$e commercial robot
Million+ollar,ips# but $as been extensi"el* en$ance! an! impro"e!'
To!a*, all t$e co!e $as been rewritten from scratc$, an! onl* a part of t$e
core of t$e strateg* is t$e same' T$is E is not a commercial pro!uct but
a"ailable for free'

Background


+uring a moment of bore!om, ( !eci!e! to take a closer look at t$is, t$e
original commercial robot, since it was so popular, an! man* also reporte!
t$at it was "er* profitable compare! to most ot$er robots' So !uring spare
times ( first !eci!e! to clean up t$e co!e so t$at ( coul! un!erstan! its
strateg*, an! $opefull* impro"e it' n! so it all starte!-

(t starte! as a one-man pro.ect, but to!a* ( regar! it as an open source
pro.ect, w$ere an*one can participate in' lt$oug$ ( tr* to super"ise it,
especiall* since ( $a"e a strict stan!ar! w$en it comes to $ow program
co!e s$oul! be written, commente! an! !ocumente! (( $a"e a back-
groun! as a teac$er in computer science an! programming%' n! as a
conse/uence, an*one w$o participates s$oul! tr* to follow t$is co!ing
stan!ar!' (t will make it easier for all'

(f *ou)re a programmer an! want to impro"e it, t$en a!! a c$aracter a#,
b# etcetera to t$e "ersion name, an! uploa! it wit$ proper comments to
t$e forum below'

+iscussions an! new "ersions are publis$e! in $ttp011www'worl!wi!e-
in"est'org forum'

Se appen!ix for "ersion $istor*2


Usage

ttac$ t$is robot on E343S+ an! 56 timeframe' (t will run on ot$er
currenc* pairs also, but will tra!e more often on E343S+' (t can be
attac$e! to an* timeframe, since it force all calculations to be !one on a
tic-basis an! t$e in!icators uses M1-timeframe' (f *ou attac$ it on an*
ot$er currenc* pair, t$en be sure t$at t$is currenc* pair $as a low sprea!'



2 | o f p a g e 1 6

T$is robot performs "er* well on backtests, it performs not as goo! on
!emo-accounts, an! in or!er to perform on li"e accounts it)s important to
use a broker t$at (1% accepts scalping wit$out limits, (7% offers a nar-
rowe! Sprea!# an! Stop 8e"el#, (9% !oes not sen! re/uotes an! slippage
too often' (n most cases, t$e robot will perform ba!l* on li"e accounts,
because of t$e abo"e problems#' lso, it)s important to $a"e t$e
MetaTra!er& platform running on a computer or ser"er as close as
possible to t$e broker ser"er in or!er to $a"e as fast execution of or!ers
as possible (latenc*%'


Input Settings

:eneral Settings0

T$e settings un!er :eneral settings# s$oul! not affect t$e tra!ing'

ReverseTrade ;* !efault t$is is set to <8SE, w$ic$ means t$at it will
open tra!es towar!s t$e center of t$e c$annel, a so calle! retracement
strateg*' (f set to T43E it will instea! open tra!es out from t$e c$annel, a
so calle! breakout strateg*' ;u* an! Sell-signals are simpl* re"erse!,

Magic T$is is known as t$e Magic5umber in MetaTra!er, a number t$at
must be uni/ue for e"er* robot attac$e! to t$e MetaTra!er platform' T$e
!efault "alue is =, w$ic$ is e/ual to t$e number for manual tra!ing' (f *ou
attac$ ot$er robots to t$e same MT& platform, t$en eac$ robot must $a"e
its uni/ue number' (f t$is is t$e onl* robot attac$e!, t$en lea"e t$is
number to =' T$e !efault settings is -1, w$ic$ will calculate t$e magic
number automaticall* base! on t$e account number an! currenc* pair'
T$is is $an!* if *ou want to appl* t$is E to se"eral c$arts, an!1or uses
ot$er E)s at t$e same time on ot$er c$arts' Since t$is will make sure t$at
none of t$em $as t$e same magic number' Magicnumber is use! b* all
E)s to i!entif* t$eir own or!ers'

!rder"#t T$is is a comment sent wit$ e"er* or!er to t$e broker, an! it
also appears in t$e Terminal win!ow un!er t$e tab Tra!e an! >omments'
T$e !efault text is XMT-Scalper# (wit$ "ersion number%' n empt*
comment line imitates manual tra!ing'

$"%&Mode Most brokers accepts t$at Take,rofit an! Stop8oss are sent
at t$e same time as t$e or!er is sent (E>5-Mo!e ? <8SE%' @owe"er,
some brokers re/uires t$e or!er to be sent wit$out Take,rofit an!
Stop8oss, an! t$en a following or!er t$at mo!ifies t$e first or!er wit$ t$e
Take,rofit an! Stop8oss (E>5-Mo!e ? T43E%' T$e !efault "alue is <8SE'
Anl* c$ange t$is to T43E if *ou)re certain t$at *our broker re/uires a
mo!if*-or!er to be sent wit$ t$e T, an! S8 after t$e actual or!er' (f set to
T43E t$e E !oes not nee! to up!ate t$e first or!er, wit$ less risk of
!ela* in t$e up!ate process'


' | o f p a g e 1 6

(e)ug (f t$ere)s an* problem wit$ t$e robot, t$en c$ange t$is from its
!efault "alue <8SE to T43E an! watc$ t$e Expert tab in t$e Terminal
win!ow for extra information' +o not lea"e t$is to T43E for longer
perio!s, since t$e log-files t$at are automaticall* create! b* MT& t$en will
become $uge'

*er)ose T$e !efault $ere is <8SE' (f set to T43E, t$en it will s$ow
more !etaile! information on t$e screen about w$at t$e robot is !oing'


Tra!e settings0

T$is robot is extremel* sensiti"e, an! t$e settings can an! must be
c$ange! to suit t$e tra!ing en"ironment, w$ic$ inclu!es broker an!
latenc* (t$e connection spee! between t$e computer w$ere *ou run MT&
from an! t$e broker ser"er%' (f t$e robot !oesn)t tra!e, or if it makes too
man* loosing tra!es, t$en a!.ust t$e settings'

Ma+Spread T$is sets t$e max allowe! Sprea! measure! in points' (f t$e
broker sprea! is $ig$er t$an t$is le"el, no tra!e will take place' <or
instance, 76 means a max allowe! sprea! of 7'6 pip' 6ou can a!.ust it to
w$ate"er le"el *ou want it to $a"e' ;ut please un!erstan! t$at t$e $ig$er
sprea! t$at is allowe!, t$e $ig$er t$e risk for losses will be'

Ma+$+ecution B$en t$e a"erage execution time excee!s t$e
MaxExecution, t$e E will not tra!e' @owe"er, if *ou want it to tra!e
an*wa*, t$en .ust set MaxExecution to =, w$ic$ is t$e same as not using
t$is feature' (f *ou want to restrict t$e execution time, t$en c$ange t$is
"alue to as man* secon!s *ou want C 1===' <or instance, 9=== means 9
secon!s, 1==== means 1= secon!s, etc' T$e "alue *ou enter is measure!
in millisecon!s' E"er* D minutes t$e E will sen! a fake Ar!er to t$e
ser"er in or!er to alwa*s $a"e an up!ate! a"erage execution' T$e E
calculates a mo"ing a"erage of execution time base! on t$e last 1=
execution times' T$is feature also works on backtests, w$ere it ran!om-
iEes execution time between = an! t$is "alue (unless *ou set t$is to =%'

(f *ou set t$is "alue to an*t$ing else t$an = !uring backtesting, it will
simulate "ariations in latenc*, similar to $ow it is tra!ing li"e' T$at is, T$e
E will count t$e a"erage ticks per minute an! will skip a number of ticks
proportional to t$e a"erage ticks per minute an! Ma+$+ecution,
assuming t$e worst case scenario t$at all or!ers will take MaxExecution
time to execute' 5ote0 T$is tick skipping is onl* !one on backtesting an!
after a Ar!erSen! or Ar!erMo!if*'

Bit$ t$is feature we can get an i!ea on $ow latenc* can !isrupt t$is
tra!ing strateg*' 6ou can see t$is feature in action if *ou make a backtest
wit$ Ma+$+ecution , - an! compare t$e same ;T wit$ for instance
Ma+$+ecution , .---/


0 | o f p a g e 1 6

,lease un!erstan! t$at !ela*e! execution !uring li"e tra!ing can !epen!
on se"eral t$ings' Ane is calle! latenc*#, w$ic$ is t$e !ela* in t$e
internet connection between *our computer an! t$e broker ser"er, often
cause! b* too muc$ traffic, an!1or low broa!ban! connection, an!1or long
!istances' n!1or it can !epen! on t$e broker, w$ere t$e ser"er is eit$er
too o"erloa!e! b* tra!ing re/uests, or b* market con!itions (a common
problem w$en tra!ing li"e wit$ real mone*% w$ere or!ers cannot be fille!'

Ma+$+ecutionMinutes B$en using MaxExecution (see abo"e%, a
;36STA, or!er is sent on a regular basis, w$ic$ t$en is mo!ifie! an!
!elete! in or!er to measure t$e execution spee! at t$e broker' ;* !efault,
t$is is !one "er* D
t$
minute' (f *ou want to c$ange t$is inter"al, t$en
c$ange t$is "alue to as man* minutes as *ou want t$is inter"al to be'
5ote0 (t s$oul! not be lower t$an D minutes' (f MaxExecution (see abo"e%
is set to =, t$en no suc$ ;36STA, or!ers are sent'

Stop1oss T$e Stop8oss is t$e number of points w$ere t$e or!er s$oul!
be close! if it goes in t$e wrong !irection' T$e "alue s$oul! not be lower
t$an t$e Take,rofit "alue' <or instance, set to 6='= means 6 pip' n! as
like Take,rofit, it)s automaticall* a!.uste! to broker STA,8EFE8 an!' So if
*ou set it too low, an! t$e broker STA,8EFE8 or <4EEEGE8EFE8 is $ig$er,
it will be recalculate! accor!ingl*' T$is "alue s$oul! normall*# not be
c$ange!' Anl* c$ange it if *ou want to make backtests an! tr* !ifferent
settings to impro"e it on ot$er currenc* pairs t$an E343S+' +efault is =,
w$ic$ means t$at it will tr* to no allow an* losses' <or practical reasons
t$is is impossible t$oug$'

Take2ro3it T$is sets t$e siEe of t$e Take,rofit in points' 5ote0 T$e
Take,rofit s$oul! not be too large, nor too small' lso, t$e Take,rofit is
automaticall* a!.uste! to broker STA,8EFE8 an! broker <4EEEGE8EFE8% if
it)s set to a too low "alue' <or instance, 1= $ere means 1= points, w$ic$ is
e/ual to 1 pip' T$is "alue s$oul! normall*# not be c$ange!' Anl* c$ange
it if *ou want to make backtests an! tr* !ifferent settings to impro"e it on
ot$er currenc* pairs t$an E343S+' +efault is 1==, w$ic$ means t$at it
initiall* sets t$e goal to make a 1= pip in profit, an! t$en trail t$e profit
furt$er'

4dd2rice5ap !!itional price gap in points a!!e! to S8 an! T, in or!er
to a"oi! Error 19=' +efault is =' (f *ou want to increase t$e gap between
t$e current price an! t$e Stop8oss an! Take,rofit for e"er* or!er, *ou can
!o so $ere' T$is gap is normall* onl* between t$e price an! t$e broker
stople"el, w$ic$ is "er* narrow an! can cause man* errors of t*pe 19=' ;*
increasing t$is gap t$e S8 an! T, is wi!ene!, an! t$e number of error 19=
is !ecrease!' T$e "alues are in points (1 1 1=% pip' 5ote0 +o not increase
t$is too muc$'

TrailingStart T$is "alue will set t$e t$res$ol! for w$en t$e TrailingStop
will start in points (1= points e/uals 1 pip%' <or instance, if *ou set it to D,
it will start trailing as soon as t$e price mo"es ='D pip from t$e or!er price
in t$e rig$t !irection' (t !oes not affect $ow muc$ t$e TrailingStop will

. | o f p a g e 1 6

increase, .ust w$en it will start' T$e increase is calculate! !*namicall*'
+efault is 79, w$ic$ means t$at it will tr* to trail profitable or!ers once it
$as reac$e! 7'9 pip in profit'

"o##ission Most brokers !o no c$arge commission, but some !o, an!
t$e* !o it on some of t$eir accounts, t*picall* so calle! E>5 accounts'
>ommission is a!!e! to or!ers w$en t$e* are close!, but t$is E also
consi!er it !uring tra!e, because t$e final cost of t$e or!er ot$erwise will
be muc$ $ig$er t$an expecte!' <or instance, if a broker c$arges H in
commission, it means t$at t$e* c$arge H 3S+ for e"er* 1'= lot' >on"erte!
to lotsiEe, t$is mean t$at t$e actual lotsiEe can be consi!ere! to be H
points (='H pip% larger t$an w$at is seen' +efault is =, an! onl* state t$e
"alue in 3S-!ollar for 1'= pip $ere (< t$e broker c$arges commission on
t$e or!ers, somet$ing t$at t$e* broker openl* !eclares on t$eir websites
for t$eir !ifferent account'

Slippage T$is sets t$e maximum allowe! !ifference in price, known as
slippage, between t$e price *ou sen! at t$e time *ou execute an or!er,
an! t$e price *ou get' (t)s measure! in points (1 1 1= pips%' +efault is 9
points'

Mini#u#UseStop1evel Ar!ers cannot be place! closer to t$e current
price t$an w$at t$e broker Stop8e"el set as a limit' T$e "alue $ere is t$e
number of points (1 1 1= pips% from t$e current price t$at Stop Ar!ers will
be place!' T$is "alue is t$en compare! wit$ t$e broker Sto8e"el, an! t$e
$ig$est of eit$er t$is "alue or t$e broker stople"el will t$en be use!'


Folatilit* Settings0

T$is is actuall* a part of t$e tra!ing settings, but co"ers more specific
settings for $ow t$e scalping s$oul! be !one'

Use(6na#ic*olatilit61i#it T$e le"el for t$e Folatilit*8imit (see below%
can eit$er be a static "alue or a !*namic "alue' (f <8SE, t$en t$e "alue
of t$e Folatilit*8imit# (see below% will be use!' (f set to T43E t$en t$e
"alue of t$e Folatilit*8imit# will be calculate! as follows0

Folatilit*Multiplier 1 1= C 4eal"erageSprea!, w$ere Folatilit*Multiplier# is
set as below, an! 4eal"erageSprea!# is t$e a"erage "alue of t$e sprea!
!uring t$e last 9= tics I an* broker commission' So for instance, if t$e
sprea! is 16 (1'6 pip% an! commission is =, t$en Folatilit*8imit# will be
7== points (or 7= pips%, since 17D 1 1= C 16 ? 7=='

*olatilit6Multiplier multiplication factor to be use! if t$e abo"e
3se+*namicFolatilit*8imit# is set to T43E' +efault 17D' ;efore *ou
c$ange t$is, please make sure t$at *ou make some calculations accor!ing
to t$e formula abo"e base! on !ifferent sprea!s so t$at *ou full*
un!erstan! $ow t$is "alue c$anges'


7 | o f p a g e 1 6

*olatilit61i#it T$is sets t$e sensiti"it* for w$en tra!ing will start, base!
on t$e siEe of t$e "olatilit* ($ow muc$ t$e prices $as mo"e!%' (t)s t$e
!istance in points between t$e $ig$est price (known as i@ig$% an! lowest
price (known as i8ow% !uring t$e current bar' (f t$e price mo"es more
t$an t$is, an or!er will be opene! in t$e opposite !irection' (f *ou set t$is
le"el to too $ig$, t$ere will be fewer tra!es, but it coul! also increase t$e
winning rate' (f it)s too low, it will start to tra!e more often, but t$e
winning rate coul! !ecrease' 5ote0 T$is is one of t$e most important
parameters to c$ange if *ou want to a!.ust t$e robot for an* ot$er
currenc* pair t$an E343S+ an! !on)t want to use 3se+*namicFolatilit*-
8imit#' (t can be as low as D= (or e"en lower% or as $ig$ as D== (or e"en
$ig$er%' "alue aroun! 1J= (1J pips% seem to be a goo! a"erage'

Use*olatilit62ercentage 5ormall* t$e Folatiliit* (t$e !ifference
between i@ig$ an! i8ow !uring t$e current bar% must be more t$an t$e
Folatilit*8imit in or!er to trigger a tra!e, !isregar!ing of $ow muc$ t$e
Folatilit*8imit is' (f t$is is set to be T43E, t$en t$is !ifference must
excee! wit$ a minimum percentage known as Folatilit*,ercentage8imit#
(see below%' <or instance, if Folatilit*,ercentage8imit# is set to 6=, t$en
t$e Folatilit* must excee! t$e Folatilit*8imit# wit$ at least 6=K' So if
Folatilit*8imit is 1J= t$en t$e Folatilit* (t$e !ifference between i@ig$ an!
i8ow% must be 1J= C 1'6 ? 7JJ points'

*olatilit62ercentage1i#it factor use! if t$e abo"e 3seFolatilit*-
,ercetage# is set to T43E, an! measure! as percentage' <or instance, 6=
means 6=K' At$erwise not use!' Set t$is to a w$ole "alue representing
$ow man* percentage more *ou want t$is to be (see explanation abo"e
un!er 3seFolatilit*,ercentage#%' T$e $ig$er t$e "alue, t$e fewer tra!es
but most likel* also stronger signals'


3se (n!icator Set0 (n!icators0
1 ? Mo"ing "erage, 7 ? ;ollinger;an!, 9 ? En"elopes0

T$is E measures t$e "olatilit*, w$ic$ is $ow strong t$e price fluctuations
are from its normal range, an! look for breakouts from a c$annel# ma!e
of an in!icator' (t)s possible to use !ifferent in!icators for t$is, an! t$is is
selecte! $ere'

(f *ou c$oose 1# for Mo"ing "erage, it will calculate two lines, one upper
an! one lower, w$ic$ toget$er will act as c$annel#'

(f *ou c$oose 7# for ;ollinger;an!#, t$en t$is in!icator will be use! to
calculate t$is c$annel#' <or t$is in!icator, t$ere)s also an option to a!.ust
;;+e"iation# (see below%'

(f *ou c$oose 9# for En"elopes#, t$en t$is in!icator will be use! instea!'
<or t$is in!icator t$ere)s a setting calle! En"elopes+e"iation# (see below%
t$at also can be a!.uste!'


8 | o f p a g e 1 6

BB(eviation <or t$e in!icator ;ollinger;an!s# t$is setting c$anges $ow
muc$ t$e calculate! "alue is allowe! to !e"iate from t$e main line' T$is is
a !ecimal "alue wit$ 1'D as a reference to start wit$' T$e $ig$er t$e "alue
is, t$e wi!er t$e c$annel# becomes' To un!erstan! t$is, *ou can attac$
t$e >ustom (n!icator# calle! ;an!s# to a c$art an! c$ange t$e setting
;an!s+e"iations# to "isuall* see $ow wi!e or narrow t$e c$annel#
becomes' 3se ,erio! ? 9'T$is is also an important parameter t$at s$oul!
be a!.uste! for ot$er currenc* pairs t$an E343S+'

$nvelopes(eviation <or t$e in!icator En"elopes# t$is setting c$anges
$ow muc$ t$e calculate! "alue is allowe! to !e"iate from t$e main line'
8ike t$e abo"e ;;+e"iation# it)s easiest to un!erstan! t$is * attac$ing
t$e in!icator En"elopes# to a c$art an! a!.ust t$e !e"iation#' 3se ,erio!
? 9' +efault "alue is ='=H'

!rder$+pireSeconds +efault is 96==, w$ic$ e/uals 96== secon!s or 1
$our, an! measures $ow long an* open or!ers s$oul! be ali"e before t$e*
are !elete!' (f set to =, t$e* will be open until t$e* are close! or !elete!
b* ot$er con!itions' T$is setting s$oul! normall* not affect t$e tra!ing'



Mone*LManagementM

Mone6Manage#ent ;* !efault t$is "alue is set to T43E, w$ic$ means
t$at lot siEe is automaticall* calculate! base! on amount of <ree margin,
4isk an! Stop8oss' (f *ou for an* reason !on)t want to use t$is but instea!
want to tra!e wit$ a fixe! lot siEe, t$en c$ange t$is to <8SE, an! also
c$ange t$e "alue of Manual8otsiEe (see below% to w$ate"er fixe! lot siEe
*ou want t$e E to tra!e wit$'

Min1ots T$is is t$e lowest allowe! lot-siEe t$at t$e robot will be tra!ing
wit$' ;* !efault t$is is set to ='=1, w$ic$ is t$e lowest lot-siEe t$at most
brokers allows' @owe"er, some brokers !oes not allow t$at small lot-siEes'
So onl* set t$is "alue if *our broker $as an* ot$er minimum for t$e lot-
siEe, A4 if *ou !o not want t$e robot to tra!e wit$ too small lot-siEes'

Ma+1ots T$is is t$e largest allowe! lot-siEe t$at t$e robot will be tra!ing
wit$' ;* !efault t$is is set to 1==' ,lease un!erstan!, t$at most brokers
!o not allow tra!ing wit$ larger lot-siEes t$an 1==, so it)s pointless to set
it to a $ig$er "alue t$an t$at' lso remember, t$at w$en tra!ing li"e, it is
less likel* t$at or!ers will be processe! if t$e lot-siEe is too big' T$ere)s
ne"er a problem to tra!e wit$ lot-siEes of 1== on !emo-accounts, but
scalping wit$ suc$ a $ig$ lot-siEes on real accounts can normall* not be
!one !ue to market con!itions' T$is "alue can also be !ecrease! if *ou
!on)t want t$e robot to increase t$e risk at t$e same rate as t$e profit
grows' Since t$e risk also !epen!s on t$e lot-siEe, w$ic$ is calculate!
!*namicall*, but ne"er is allowe! to be $ig$er t$an t$is "alue' @owe"er,
risk le"el s$oul! be a!.uste! wit$ t$e 4isk# setting (see below% an! not
t$is setting'

9 | o f p a g e 1 6


Risk T$is sets t$e risk *ou accept for eac$ separate or!er' T$e actual risk
is wit$in 1==K to 1D=K of t$is "alue' n exception is w$en in!icator T4
is use! (see abo"e%, w$ere t$e risk percentage increases' <or instance, if
*ou set t$e risk to 7, t$en not more t$an 7K to 9K of t$e current balance
will be at risk per or!er' (t can be set to an*t$ing between ='1 an! NN'
T$e risk siEe calculates t$e lotsiEe as follows0 E/uit* C 4isk 1 1== 1
Stop8oss' So if t$e free margin is 1====, t$e 4isk is 7, an! t$e Stop8oss
is 6=, t$e t$e lotsiEe will be 9'99 (since 1==== C 7 1 1== 1 6= ? 9'99%'
T$is assumes t$at t$e or!er will $it Stop8oss, resulting in a loss of 4iskK
of t$e E/uit* (t$e amount of mone* t$at t$e broker allow *ou to tra!e
wit$%' 5ote0 T$e 4isk is alwa*s re-calculate! e"er* time t$e E starts, so
t$at it)s wit$in t$e allowe! limits' 5ote0 t$e 4isk cannot be set to a "alue
lower t$an ='1K' (f *ou set it to =, it will be re-a!.uste! to t$e lowest
possible 4isk' n! if *ou set t$e 4isk to 1==, it will be a!.uste! to t$e
$ig$est possible 4isk'

Manual1otsi:e0 ;* !efault, t$is is ne"er use!, since lot siEe will be
calculate! automaticall*' @owe"er, if *ou want to tra!e wit$ fixe! lot siEe,
t$en c$ange Mone*Management (see abo"e% to <8SE, an! set t$is "alue
to w$ate"er *ou want it to be' 5ote0 8otsiEe is alwa*s re-calculate! to
make sure t$at it)s wit$in t$e allowe! limits, so it)s not possible to force it
be*on! t$e 4isk limits'



ScreenLS$ooter0

TakeShots T$is feature will make screen !umps e"er* time an or!er is
execute!, an! sa"e t$e pictures wit$ t$e file name SnapS$ot# I currenc*
pair I MD# I#*ear-mont$-!a*# I $ourLminLsec# I number I 'gif#'

(ela6Ticks 5umber of tics to !ela* after e"er* new bar'

Shots2erBar 5umber of screen s$ots per bar'


1og 3ile

T$e E writes a log file, w$ic$ is sa"e! in expert1files (if *ou run !emo or
li"e account% an! in tester1logs (if *ou run Strateg* Tester% as current
!ate'log#' 6ou can access t$is file at an* time to "iew more !etails about
t$e broker an! t$e actual tra!ing, w$et$er t$is is on !emo or li"e account,
or after backtests' T$e first part of t$is log file contains t$e settings,
followe! b* broker information' T$en follows t$e actual tra!e information'
n! if *ou $a"e acti"ate! t$e +ebug# mo!e (see abo"e%, t$is log file will
also contain lots of ot$er information' Ance t$e E $as stoppe!, t$e last
part of t$is log file will also contain a summariEe! report about all errors
recei"e! from t$e broker ser"er'


; | o f p a g e 1 6


Backtesting

6ou can run t$e Strateg* Tester# in MetaTra!er & for backtests using an*
timeframe, but must loa! @istorical +ata for t$e timeframe M1 for t$e
currenc* pair t$at *ou)re testing' ,lease un!erstan! t$at t$e $istorical
!ata !oes not come from t$e broker but from MetaOuotes, t$e compan*
be$in! MetaTra!er &' T$e prices can an! will for sure !iffer slig$tl*' T$e
sprea! on t$e ot$er $an! is a fixe! sprea! t$at comes from t$e broker at
t$e time *ou run t$e backtest, an! it !iffers from e"er* time *ou run t$e
backtest' s a result *ou will get !ifferent results eac$ time *ou run t$e
backtest' n! !uring weeken!s t$e sprea! is extremel* $ig$' To o"errule
t$is, ( recommen! t$at *ou !ownloa! an! install t$e program an! script
Sprea! >ontroller# (aka Sprea! >$anger#% from
$ttp011www'mt&i'com1sprea!controller'aspx ' Bit$ t$is, *ou can set an*
sprea! *ou want'

,lease also un!erstan! t$at t$e $istorical !ata from MetaOuotes for M1
!oes not inclu!e t$e prices for e"er* tick, but onl* for e"er* bar (e"er*
minute%' T$is means t$at MetaTra!er simulates t$e tick !ata wit$in e"er*
bar, making backtests unreliable' T$at is, backtests can ne"er be 1==K
true, an! s$oul! onl* be use! to compare an! e"aluate !ifferent settings'
n! gi"e an o"erall un!erstan!ing of t$e tra!ing results'

(t)s possible to !o backtests using complete tick !ata from t$e compan*
+ukas>op*' 6ou can rea! more about t$is at $ttp011eare"iew'net1tick-
!ata'


Strateg6

T$e strateg* of XMT-Scalper is scalping on tic-basis, w$ere t$e E opens
;36STA, or SE88STA, or!ers w$en price breakouts occurs base! on a
specific in!icator' T$e in!icator is eit$er two Mo"ing "erages#, ;ollinger
;an!# or En"elopes# for t$e last 9 minutes' n* of t$e in!icators can be
use! as !eci!e! from t$e external settings 3se(n!icatorSwitc$#'

<or all in!icators, a c$annel# is calculate!' n! $ow wi!e t$is c$annel will
be is !eci!e! b* PFolatilit*8imitP in points, w$ic$ b* !efault is calculate!
an! a!.uste! !*namicall*, but also can be set to a fix "alue' (f !*namic, it
calculates t$is "alue as a multiplication of t$e a"erage sprea! !uring t$e
last 9= tics, an! t$e "alue of t$e PFolatilit*MultiplierP'

@ow muc$ t$e breakout s$oul! be in percentage of t$e ban!-wi!t$ is set
b* PFolatilit*,ercentage8imitP in percentage of t$e c$annel wi!t$'

Anl* one or!er is opene! at a time, an! an opene! ;36STA, 1 ;36SE88
or!er is treate! !ifferentl* from an opene! ;36 1 SE88 or!ers as follows0


1- | o f p a g e 1 6

n open ;36-or!er is mo!ifie! wit$ a new Stop8oss (S8% an! Take,rofit
(T,% if its current Take,rofit# is less t$an t$e current sk price# I
>ommission# I Take,rofit# I !!,rice:ap# 5+ current sk price# I
>ommission# I Take,rofit# I !!,rice:ap# Q existing Take,rofit# is
larger t$an t$e TrailingStart#'

n open SE88-or!er is in a similar wa* mo!ifie! wit$ a new S8 an! T, if
its current Take,rofit# is greater t$an current ;i!-price# - >ommission#
I Take,rofit# Q !!,rice:ap# 5+ current Take,rofit# Q current ;i!-
price# Q >ommission# I Take,rofit# Q !!,rice:ap# is larger t$an t$e
TrailingStart#'

T$e S8 for t$e mo!ifie! ;36-or!er is c$ange! to current ;i!-price# Q
Stop8oss# Q !!,rice:ap#, an! t$e T, to t$e current sk-price# I
>ommission# I Take,rofit# I !!,rice:ap#'

n! for t$e mo!ifie! SE88-or!er, t$e S8 is c$ange! to current sk-price#
I Stop8oss# I !!,rice:ap#, an! T, to current ;i!-price# Q
>ommission# Q Take,rofit# Q !!,rice:ap#'

Apen ;36STA, an! SE88STA, or!ers are eit$er mo!ifie! or !elete!' T$e*
are mo!ifie! wit$ new S8 an! T, as follows'

n open ;36STA, or!er is mo!ifie! if t$e current sk-price# I
Stop8e"el# I !!,rice:ap# is less t$an t$e Ar!erApen,rice# 5+ t$e
Ar!erApen,rice# Q current sk-price# I Stop8e"el# I !!,rice:ap# is
greater t$an TrailingStart#'

n open SE88STA, is mo!ifie! wit$ new S8 an! T, if current ;i!-price# Q
Stop8e"el# Q !!,rice:ap# is greater t$an Ar!erApen,rice 5+
current ;i!-price# Q Stop8e"el# - !!,rice:ap# Q Ar!erApen,rice is
greater t$an TrailingStart#'

(f t$e con!itions are not met for t$e ;36STA, or SE88STA, or!er, t$en
t$e* are !elete!'


<inal note

T$e !efault settings are not optimiEe! in an* wa*' (t)s recommen!e! t$at
*ou start testing on E343S+ before tr*ing it on an* ot$er pair, simpl*
because t$is pair offers t$e lowest sprea!' (f *ou want to run it on an*
ot$er currenc* pair, t$en please remember t$at a small, narrow sprea!
an! stople"el as well as fast execution are t$e most important factors' (t)s
pointless to tr* to use t$is robot on currenc* pairs t$at are more t$an 9
pips in sprea!, or wit$ brokers t$at uses too wi!e stople"el Q unless *ou
also wi!en t$e Stop8oss, Take,rofit an! TrailingStart accor!ingl*' 6ou also
nee! to run backtests wit$ !ifferent settings to fin! t$e best combination
of settings' n! if *ou want to tr* it on a li"e account, t$en please
remember t$at most brokers uses a muc$ $ig$er sprea! on t$eir real

11 | o f p a g e 1 6

accounts t$an on t$eir !emo-accounts' So be sure t$at *ou know t$e
t*pical sprea! an! stople"el for t$e real account first'

<in!ing a goo! broker is extremel* important if *ou)re going to run t$e
robot on a li"e account wit$ real mone*' <irst of all, t$e broker must
accept scalping wit$out restrictions' Secon!l*, t$e broker must offer low
sprea!s' An t$e E343S+ t$is means less t$an 7 pips, preferabl* 1 pip or
less' T$e reason, is because t$e robot makes man* small tra!es an! exits
tra!es wit$in a minute or so' T$ir!, t$e stople"el must also be low' T$is is
$ow man* pips t$at must !iffer between t$e current price an! t$e price
for takeprofit an! stoploss' T$is stople"el is usuall* also !ifferent between
currenc* pairs' ll t$at information for t$e broker can easil* be seen from
t$e Strateg* Tester# in MetaTra!er' >$oose t$e currenc* pair (E343S+%
an! click on S*mbol ,roperties#, an! *ou will see information about
sprea!, stople"el, etc' <ourt$, t$e broker s$oul! not use commission, or
at least $a"e a "er* low commission rate' ;ecause ot$erwise, most, if not
all, of t$e profit will be #eaten up# b* t$e commission'

,lease excuse an* explanation an!1or t*ping errors2

(f *ou fin! an* bugs an!1or $a"e suggestions for impro"ements, t$en
contact me at t$e forum $ttp011www'worl!wi!e-in"est'org'

-----------------------------------------------------------------------------------

To-do list
- Stealt$ tra!ing as an option, w$ere S8, T, an! unnecessar* Ar!erMo!if*
comman!s are not sent to t$e broker, but all manage! internall*'
- AptimiEe settings for !ifferent currenc* pairs'
- Make t$e E more profitable e"en !uring ba! con!itions (slow execution
spee!, $ig$ sprea!, re/uotes, etc%'
- (mpro"e tra!ing signals'

4ppendi+
Fersion $istor*0
Fer' 1'= (7=11-=N-7&% b* >apella0

- >leane! program co!e t$at is full* rea!able, wit$ proper names for functions an!
"ariables, an! unuse! "ariables an! program co!e remo"e!'

- +*namic settings for Take,rofit an! Stop8oss can now be c$ange! from external
settings as Folatilit*8imit an! Scalpfactor'

- <orce! TrailingStop, as all tests s$ows t$at t$is is man!ator* to make profit'

12 | o f p a g e 1 6


- T$is manual wit$ explanation on $ow to use t$is robot'

Fer' 7'= (7=11-1=-79% b* >apella0

- >$ange! name from M+,-e!u to M+,-,lus'

- utomatic trailing stop'

- !!e! a!!itional settings for scalping as follows0 3seMo"ing"erage,
3se;ollinger;an!s, an! Ar!erExpireSecon!s'

- >leane! t$e co!e e"en more, to make it more rea!able'

Fer' 7'1 (7=11-11-=1% b* >apella0

- !!e! (n!icator,erio! as external parameter'

- Mo!ifie! calculation of t$e "ariable t$at triggers tra!e for better
,erformance'

- 4emo"e! +istance as an external, an! automaticall* a!.ust it to be t$e same as broker
STA,8EFE8 instea!, in or!er to o"ercome error 19=' Error 19= can still occur t$oug$,
!epen!ing on t$e fact t$at t$e robot tries to mo!if* t$e Stop8oss as close as possible to
t$e broker STA,8EFE8' @owe"er, in most cases t$e Stop8oss will be mo!ifie! t$e
following tic'

- 4emo"e! call for t$e function subLmo"ean!fillarra*s# as it !oesnRt make an*
!ifference'

Fer 7'1'1 - 7=11-11-=D b* >apella0

- <ixe! a bug in t$e calculation of localL$ig$est# an! localLlowest# t$at
cause! wrong calls for Ar!erMo!if*#'

- >$ange! t$e calculation of STA,8EFE8 to also consi!er <4EEGE8EFE8'

Fer 7'1'7 - 7=11-11-=6 b* >apella0

- >$ange! !efault settings accor!ing to extensi"e optimiEe! backtests using a wi!e fixe!
sprea! of 1'6 pips'

- !!e! external parameter +e"iation for i;an!s, !efault 7'='

Fer 7'1'9 - 7=11-11-=H b* >apella0

- <ixe! a bug for calculation of localLisbi!greatert$anin!*# t$at ne"er triggere!
;36LSTA,# an! SE88LSTA,# or!er to be mo!ifie!'

Fer 7'1'& - 7=11-11-=N b* >apella0

- <ixe! a bug t$at onl* ma!e t$e robot tra!e on SE88 an! SE88STA,'
- ,ut back t$e call for t$e sub PsubLmo"ean!fillarra*sP except t$e last nonsense part of
it' T$e first part !i! make sense'
- >$ange! t$e !efault settings an! re-or!ere! t$e global "ariables'


1' | o f p a g e 1 6


Fer 7'1'D - 7=11-11-1= b* >apella0

- <ixe! a bug t$at cause! t$e robot to not tra!e for some brokers (if "ariable
PlocalLscalpsiEeP was ='=%'
- <ixe! a bug t$at coul! cause t$e lot-siEe to be calculate! wrongl*'
- ;etter output of !ebug information (more information%'
- Mo"e! a fixe! internal Max Sprea! to an external' T$e !efault internal "alue was &= (&
pips%, w$ic$ is too $ig$ (M@('
- 4ename! some local "ariables to more proper names in or!er to make t$e co!e more
rea!able'
- >leane! co!e furt$er b* remo"ing unuse! co!e'

Fer 7'1'Da - 7=11-11-1D b* blueprint1NH70

- !!e! Execution time in log files, to measure $ow fast or!ers are execute! at t$e
broker ser"er'

Fer 7'7 - 7=11-11-1H b* >apella0

- n option to calculate Felolcit*8imit# !*namicall* base! on t$e sprea!'
- 4emo"e! parameter Scalpfactor# as it $a! no impact on t$e tra!ing con!itions, onl* on
lotsiEe'
- Mo"e! t$e parameter (n!icator,erio!# to a global "ariable, as c$anging t$is "alue $a!
little or no impact on t$e tra!ing' T$e "alue is set to 9, so in!icators are calculate! 9 bars
back'
- ;etter lot calculation, now entirel* base! on <reeMargin, 4isk an! Stop8oss'
- new scalp factor calle! +*namicFolatilit*8imit# base! on t$e !ifference between
Folatilit*8imit an! i@ig$ 1 i8ow for triggering tra!es'
- T$e robot can now tra!e automaticall* on all currenc* pairs wit$in sprea! limit from
one single c$art'
- !!e! broker Suffix'
- (t now works on &-!igit brokers as well' @owe"er, t$e performance on &-!igit brokers is
worse t$an on D-!igit brokers, an! t$ere are muc$ less tra!es'

Fer 7'7'1 - 7=11-11-1J b* >apella0

- <ixe! a bug for calculation of >ommission' T$e "ariables PlocalLcommissionpipsP an!
PlocalLcommissionfactorP mo"e! from locals to globals'

Fer 7'7'1'7 - 7=11-11-1J b* Sonik0

- !!e! Screens$ot <unctionalit*'

Fer 7'7'7 - 7=11-11-1N b* >apella0

- !!e! automatic calculation of Magic5umber as an option'
- !.ust Min8ot to broker minimum'
- >orrection of lotsiEe calculation accor!ing to broker lotstep'

Fer 7'7'9 - 7=11-11-71 b* >apella0

- <ixe! bug for calculation of lotsiEe calculation accor!ing to broker lotstep'
- !!e! broker >omission as an external parameter, an! correcte! t$e calculation'
- 4e-arrrange! some co!e - mo"ing parts to subroutines'


10 | o f p a g e 1 6


Fer 7'7'& - 7=11-11-79 b* >apella
- Improved performance.
- Cleaned code further and moved parts of code to subroutines.

Ver 2.2.4a - 2011-11-24 by blueprint.
- Added execution control.

Fer 7'7'&b - 7=11-11-7& b* ,annik
- !!e! manual fixe! lots as an option'

Fer 7'7'D Q 7=11-11-7D b* >apella

- <ixe! bug for too small lot siEe an! wrong 4isk settings'
- >$ange! ran!omiEe! execution time for backtests to be wit$in = an! MaxExecution'
- >leane! t$e co!e furt$er'

Fer 7'7'6 - 7=11-11-7D b* >apella

- <ixe! bug for too large lotsiEe'
- <ixe! t$e bug for Tra!e88>urrenc*,airs'
- Mo"e! broker suffix from external parameter to automaticall* calculate! in a subroutine
- 4emo"e! unnecessar* program co!e, cleane! an! organiEe! t$e co!e furt$er

Fer 7'7'H - 7=11-11-9= b* >apella

- <ixe! a bug for t$e broker >ommission

Fer 7'7'J - 7=11-17-=& b* >apella
- 4emo"e! Tra!e88>urrenc*,airs as it was too bugg* an! coul! not cope wit$ t$e fast
tra!es, better attac$ on separate c$arts'
- <ixe! bug w$ere iM was use! instea! of eit$er1or iM1i;an!s for mo!*f*ing ;36STA,
an! SE88STA, or!ers'
- 4ewrote some of t$e co!e to make it easier to follow an! un!erstan!'
- 4ewrote subs to c$eck lotsiEe an! risk settings, an! a!.ust t$em accor!ingl*
- !!e! more comments to program co!e'
- !!e! time for $ow often fake or!ers s$oul! be sent in or!er to calculate execution
spee! (MaxExecutionMinutes%'
- 4emo"e! unuse! "ariables an! co!e'

Fer 7'9 - 7=11-17-=J b* >apella
- >$ange! name of t$e E (from M+,-,lus% as t$e t$rea! in t$e forum once again was
!elete!' T$is E is now a cop*rig$te! s$areware Q a non-commercial pro!uct free to use'
- 4emo"e! Tra!e88>urrenc*,airs as it was too bugg* an! coul! not cope wit$ t$e fast
tra!es, better attac$ on separate c$arts'
- <ixe! bug w$ere iM was use! instea! of eit$er1or iM1i;an!s for mo!if*ing ;36STA,
an! SE88STA, or!ers'
- 4ewrote some of t$e co!e to make it easier to follow an! un!erstan!'
- 4ewrote subs to c$eck lotsiEe an! risk settings, an! a!.ust t$em accor!ingl
- !!e! more comments to program co!e'
- !!e! time for $ow often fake or!ers s$oul! be sent in or!er to calculate execution
spee!'
- 4emo"e! unuse! "ariables an! co!e'
- !!e! c$eck so no tra!ing can start before we $a"e gat$ere! enoug$ of ;ar-!ata'
- Mo"e! Slippage to an external parameter so it can be c$ange!'
- !!e! summation of broker error co!es'


1. | o f p a g e 1 6


Fer 7'9'1 - 7=11-17-=J b* >apella
- <ixe! a bug t$at coul! cause lotsiEe to be greater t$an Max8ots'

Fer 7'9'7 - 7=11-17-=N b* blueprint1NH7
- !!e! option for simulate! latenc* !uring backtests'

Fer 7'9'7b - 7=11-17-=N b* !erox
- !!e! iEn"elopes an! iT4 as in!icators'

Fer 7'9'7c - 7=11-17-1= b* ,annik
- !!e! P3se(n!icatorSwitc$P for c$oosing in!icator to use'

Fer 7'9'7! - 7=11-17-17 b* !erox
- !!e! ll"erages as in!icator' 5ote0 T$is re/uires external in!icator'

Fer 7'9'9 - 7=11-17-17 b* >apella
- !!e! !!,rice:ap as an external parameter to increase S8 an! T, in or!er to
!ecrease number of error 19='
- 4eplace! iM wit$ ll"erages'
- 4emo"e! iM 5+ i;an!s combination'
- <ixe! minor bugs'
- >leane! up t$e co!e furt$er'

Fer 7'9'& - 7=11-17-19 b* >apella
- 4emo"e! ll"erages as it !i!nRt make an* !ifference compare! to stan!ar! Mo"ing
"erage'
- <ixe! bug for iT4 in!icator'
- !!e! !ual-tra!e as an option for iT4'

Fer 7'& Q 7=11-=N-=6 b* >apella
- 4emo"e! some external settings incl' T4 an! its settings'
- !!e! external settings Minimum3seStop8e"el#
- <ixe! bugs, so it works better wit$ !ifferent brokers wit$out error 19='

Fer 7'&'1 - 7=17-1=-79 b* >apella
- !!e! c$eck for w$en E>5LMo!e ?? T43E an! ;361SE88 or!ers $a"e not *et been
mo!ifie!, to pre"ent running or!ers wit$out S8' Bait 1 secon! an! t$en mo!if* t$e or!er
wit$ a S8 t$at is 9 pip from current price'
- >$ange! !efault settings after extensi"e backtests using NNK tick-!ata'

Fer 7'&'7 - 7=19-=H b* >apella
- !!e! lot-siEe re-calculation if ccount >urrenc* is not 3S+ but eit$er E34, :;,, >@<
or S,6
- !!e! 4e"erseTra!e as an option
- >$ange! algorit$m for automaticall* calculation of magic number
- !!e! printout info if t$ere was no errors reporte! from t$e broker ser"er

Fer 7'&'9 - 7=1&-=D b* >apella
- <ixe! bug - ;;+e"iation is (5T not +ouble
- Mo"e! (n!icator,erio! to externals
- Minor bugs fixe!
- >ompilation test on bot$ MT& ;uil! D=N as well as on 61=

Fer 7'&& - 7=1&-=J-76 b* >apella
- >$ange! "ersion presentation to onl* one point ( ' %, i'e' 7'&'&' becomes 7'&&
- !!e! control of stra* tra!es (tra!es wit$out S8 an! T,%'
(f it fin!s a stra* or!er it will tr* to a!! a S8 1= points from current price'
- >$ange! $ow Minimum3seStop8e"el is calculate! an! use!' 5ow t$e Stop8e"el is t$e
$ig$est "alue of

17 | o f p a g e 1 6

eit$er t$is "alue or t$e ;roker Stop8e"el' T$is Stop8e"el is t$en a!!e!1substracte!
from t$e current price for ;u*Stop an! SellStop or!ers' T$e "alue expresse! in ,oints'
- !!e! spaces aroun! ( an! % an! after commas , to en$ance rea!abilit*
- !!e! 3+ an! 5G+ as possible account currencies for calculation of multiplicator
(use! to correct lotsiEe%, an! mo"e! it to a subroutine'

You might also like