Thread: Martingale EA
View Single Post
  #709 (permalink)  
Old 02-24-2008, 05:02 PM
wolfe's Avatar
wolfe wolfe is offline
Senior Member
 
Join Date: Jan 2006
Posts: 820
wolfe is on a distinguished road
Quote:
Originally Posted by ElectricSavant View Post
What criteria is used to determine trend direction?

ES


If Long_Short_Balance is true, you CAN NOT choose your own progression.
Long_Short_Balance uses the Start_Lot_Size & the Lot_Size_Increment. When a trend direction change is detected and another trade signal occurs, the EA will "equalize" the long and short lot sizes (now you are fully hedged), plus it will add Balance_Weight to the side of you're new trend.
Depends if you are using MA entry, or kayvan method, pyramid true, or pyramid false.

Basically a Long_Short_Balance would happen if your last order was a short, and you just got a signal to open a long. Or the other way around of course. This would happen only if Long_Short_Balance was set to true, and ALL other lot size decisions were set to false.

Right here is what I had to code JUST to determine the next lot size in a trade progression, depending on how the user set it up.
PHP Code:
if (Double_Lotsize==false)
         {
          
Lot_Size=LastLots+Lot_Size_Increment;
         }
        if (
Double_Lotsize==true)
         {
          
Lot_Size=LastLots*2;
         }
        if (
Long_Short_Balance==true)
         {
          if (
SellLots>BuyLots)
           {
            
Lot_Size=((SellLots-BuyLots)+Balance_Weight);
           }
          else 
Lot_Size=LastLots+Lot_Size_Increment;
         }
        if (
Choose_Own_Progression==true)
        {
         if(
OTBM(Magic_Number)==1){Lot_Size=Trade_2;}if(OTBM(Magic_Number)==2){Lot_Size=Trade_3;}
         if(
OTBM(Magic_Number)==3){Lot_Size=Trade_4;}if(OTBM(Magic_Number)==4){Lot_Size=Trade_5;}
         if(
OTBM(Magic_Number)==5){Lot_Size=Trade_6;}if(OTBM(Magic_Number)==6){Lot_Size=Trade_7;}
         if(
OTBM(Magic_Number)==7){Lot_Size=Trade_8;}if(OTBM(Magic_Number)==8){Lot_Size=Trade_9;}
         if(
OTBM(Magic_Number)==9){Lot_Size=Trade_10;}if(OTBM(Magic_Number)==10){Lot_Size=Trade_11;}
         if(
OTBM(Magic_Number)==11){Lot_Size=Trade_12;}if(OTBM(Magic_Number)==12){Lot_Size=Trade_13;}
         if(
OTBM(Magic_Number)==13){Lot_Size=Trade_14;}if(OTBM(Magic_Number)==14){Lot_Size=Trade_15;}
         if(
OTBM(Magic_Number)==15){Lot_Size=Trade_16;}if(OTBM(Magic_Number)==16){Lot_Size=Trade_17;}
         if(
OTBM(Magic_Number)==17){Lot_Size=Trade_18;}if(OTBM(Magic_Number)==18){Lot_Size=Trade_19;}
         if(
OTBM(Magic_Number)==19){Lot_Size=Trade_20;}
         }
        
RefreshRates();
        
Ticket=OrderSend(Symbol(),OP_BUY,Lot_Size,Ask,Slippage,NULL,NULL,"TFX_LONG_ADDITIONAL",Magic_Number,0,Green); 
As you see it got very confusing, and it does have some limitations. Code reads left to right, top to bottom, just as you or I would.(only it does this in a nano second)

Now you can see the last decision method the code reads is this one:
PHP Code:
if (Choose_Own_Progression==true)
        { 
If Choose_Own_Progression is set to true, this is the last thing the code reads to decide which method for lot size it will use, all others that were true will not execute. Only the last one that the code read to be true.

Sorry if I just confused you more.

Last edited by wolfe; 02-24-2008 at 05:22 PM.
Reply With Quote