Anti-Martingale money management for forex 0

Posted on 12, March 2014

in Category SID


Description for AntiMartingale SID 181

Anti-Martingale money management for forex

A basic Anti-Martingale money managment for forex:

Description from:

http://en.wikipedia.org/wiki/Martingale_(betting_system)

This is also known as the reverse martingale. In a classic martingale betting style, gamblers increase bets after each loss in hopes that an eventual win will recover all previous losses. The anti-martingale approach instead increases bets after wins, while reducing them after a loss. The perception is that the gambler will benefit from a winning streak or a “hot hand”, while reducing losses while “cold” or otherwise having a losing streak. As the single bets are independent from each other (and from the gambler’s expectations), the concept of winning “streaks” is merely an example of gambler’s fallacy, and the anti-martingale strategy fails to make any money. If on the other hand, real-life stock returns are serially correlated (for instance due to economic cycles and delayed reaction to news of larger market participants), “streaks” of wins or losses do happen more often and are longer than those under a purely random process, the anti-martingale strategy could theoretically apply and can be used in trading systems (as trend-following or “doubling up”).
Anti Martingale money management for forex/sid The logic for this Position Sizing Strategy:

Anti Martingale money management for forex/sid PositionSize:

my $lastTrade = TradeHistory(1);

if($currentUnits==0){
	$currentUnits = $units;
}

if($lastTrade){
	my $profit = $lastTrade->NetProfit;

	if($profit>0){
		$currentUnits = $currentUnits*2;
	}else{
		$currentUnits = $units;
	}
}

return RoundToUnitSize(ForexUnitsAvailable($currentUnits));

Anti Martingale money management for forex/sid BuyMarket event logic:

if (ShortPosition) {
  #If we have a short position, close it.
  PlaceBuyOpen('AntiMartingale_Close_Short');
}
else {
  #we have no position, or we are long.
  my $num=PositionSize();
  PlaceBuyOpen('AntiMartingale_Open_Long',$num) if $num;
}

Anti Martingale money management for forex/sid BuyStop event logic:

my $stop=shift;
#Stop trading if we do not have a stop price
die 'No stop price for BuyStop' unless $stop;

if (ShortPosition) {
  #If we have a short position, close it.
  PlaceBuyStop('AntiMartingale_Close_Short',0,$stop);
}
else {
  #we have no position, or we are long.
  my $num=PositionSize();
  PlaceBuyStop('AntiMartingale_Open_Buy_Stop',$num,$stop) if $num;
}

Anti Martingale money management for forex/sid BuyLimit event logic:

my $limit=shift;
#Stop trading if we do not have a limit price
die 'No limit price for BuyLimit' unless $limit;

if (ShortPosition) {
  #If we have a short position, close it.
  PlaceBuyLimit('AntiMartingale_Close_Short',0,$limit);
}
else {
  #we have no position, or we are long.
  my $num=PositionSize();
  PlaceBuyLimit('AntiMartingale_Open_Buy_Limit',$num,$limit) if $num;
}

Anti Martingale money management for forex/sid BuyStopLimit event logic:

my ($stop,$limit)=@_;
#Stop trading if we do not have a stop and limit price
die 'No limit price for BuyStopLimit' unless $limit;
die 'No stop price for BuyStopLimit' unless $stop;

if (ShortPosition) {
  #If we have a short position, close it.
  PlaceBuyStopLimit('AntiMartingale_Close_Short',0,$stop,$limit);
}
else {
  #we have no position, or we are long.
  my $num=PositionSize();
  PlaceBuyStopLimit('AntiMartingale_Open_Long',$num,$stop,$limit) if $num;
}

Anti Martingale money management for forex/sid SellMarket event logic:

if (LongPosition) {
  #If we have a long position, close it.
  PlaceSellOpen('AntiMartingale_Close_Long');
}
else {
  #If we have no position or we are short, place the order
  my $num=PositionSize();
  PlaceSellOpen('AntiMartingale_Open_Short',$num) if $num;
}

Anti Martingale money management for forex/sid SellStop event logic:

my $stop=shift;
#Stop trading if we do not have a stop price
die 'No stop price for SellStop' unless $stop;

if (LongPosition) {
  #If we have a long position, close it.
  PlaceSellStop('AntiMartingale_Close_Long',0,$stop);
}
else {
  #If we have no position or we are short, place the order
  my $num=PositionSize();
  PlaceSellStop('AntiMartingale_Open_Sell_Stop',$num,$stop) if $num;
}

Anti Martingale money management for forex/sid SellLimit event logic:

my $limit=shift;
#Stop trading if we do not have a limit price
die 'No limit price for SellLimit' unless $limit;

if (LongPosition) {
  #If we have a long position, close it.
  PlaceSellLimit('AntiMartingale_Close_Long',0,$limit);
}
else {
  #If we have no position or we are short, place the order
  my $num=PositionSize();
  PlaceSellLimit('AntiMartingale_Open_Sell_Limit',$num,$limit) if $num;
}

Anti Martingale money management for forex/sid SellStopLimit event logic:

my ($stop,$limit)=@_;
#Stop trading if we do not have a stop and limit price
die 'No limit price for SellStopLimit' unless $limit;
die 'No stop price for SellStopLimit' unless $stop;

if (LongPosition) {
  #If we have a long position, close it.
  PlaceSellStopLimit('AntiMartingale_Close_Long',0,$stop,$limit);
}
else {
  #If we have no position or we are short, place the order
  my $num=PositionSize();
  PlaceSellStopLimit('AntiMartingale_Open_Short',$num,$stop,$limit) if $num;
}

0 Comments

Leave a Message