Jump to content

Shibumi EA


Recommended Posts

Re: Shibumi EA

 

Hi.. Thanks for sharing..

 

Just a couple of quick things.. From what I can tell this code wont work with 5 digit brokers.. You are using the point variable.. Which has an extra decimal place on 5 digi servers. Have you tried this on 5 digi servers (FxPro)..

 

Instead create your own LocalPoint variable with something like this in the init section..

 

LocalPoint = Point*MathPow(10,Digits%2);

 

Then do all your StopLoss,TakeProfit and stuff like that calcs with that localpoint instead of point.. This works on 4-5 whatever..

 

Then Haw Haw... Its funny... Your using the MagicNumber code I put out years ago on another forum..

Heres a much better line that takes into account full, mini, micro & ecn type pair names..

you can see how it searches for pair names.. I also uses the account number in the calc just to make sure no one any where could have the same magic... (The brokers search for same magic and know what ea does that, most users dont change default).. this code is totally random.. 5 variables are used.. account number, currency pair, time frame, the divisor, and MagicBase (which never really needs to be changed)..

 

//+------------------------------------------------------------------+
//|                                               SetMagicNumber.mq4                  
//|                                                                  
//|                                                                  
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

  int MagicNumber;
  extern int MagicBase = 3;  //extra local randomizer.. just for fun..



//+------------------------------------------------------------------+
//| My function  SetMagicNumber                                                    |
//+------------------------------------------------------------------+
// 
//   
//    
// 
void SetMagicNumber()  
{
  string iSymbol = "i "+Symbol();
  MagicNumber = 0;
              
  if (StringFind(iSymbol, "AUDCAD", 0) > 0) MagicNumber = 10;
  if (StringFind(iSymbol, "AUDJPY", 0) > 0) MagicNumber = 20;
  if (StringFind(iSymbol, "AUDNZD", 0) > 0) MagicNumber = 30;
  if (StringFind(iSymbol, "AUDUSD", 0) > 0) MagicNumber = 40;
  if (StringFind(iSymbol, "CHFJPY", 0) > 0) MagicNumber = 50;
  if (StringFind(iSymbol, "EURAUD", 0) > 0) MagicNumber = 60;
  if (StringFind(iSymbol, "EURCAD", 0) > 0) MagicNumber = 70;
  if (StringFind(iSymbol, "EURCHF", 0) > 0) MagicNumber = 80;
  if (StringFind(iSymbol, "EURGBP", 0) > 0) MagicNumber = 90;
  if (StringFind(iSymbol, "EURJPY", 0) > 0) MagicNumber = 100;
  if (StringFind(iSymbol, "EURUSD", 0) > 0) MagicNumber = 110;
  if (StringFind(iSymbol, "GBPCHF", 0) > 0) MagicNumber = 120;
  if (StringFind(iSymbol, "GBPJPY", 0) > 0) MagicNumber = 130;
  if (StringFind(iSymbol, "GBPUSD", 0) > 0) MagicNumber = 140;
  if (StringFind(iSymbol, "NZDJPY", 0) > 0) MagicNumber = 150;
  if (StringFind(iSymbol, "NZDUSD", 0) > 0) MagicNumber = 160;
  if (StringFind(iSymbol, "USDCHF", 0) > 0) MagicNumber = 170;
  if (StringFind(iSymbol, "USDJPY", 0) > 0) MagicNumber = 180;
  if (StringFind(iSymbol, "USDCAD", 0) > 0) MagicNumber = 190;
  if (StringFind(iSymbol, "XAUUSD", 0) > 0) MagicNumber = 200;
  if (StringFind(iSymbol, "XAGUSD", 0) > 0) MagicNumber = 210;
  if (StringFind(iSymbol, "GOLD", 0) > 0) MagicNumber = 220;
  if (StringFind(iSymbol, "#CL", 0) > 0) MagicNumber = 230; // oil in case you didnt know
  if (StringFind(iSymbol, "DJI", 0) > 0) MagicNumber = 240;
  if (StringFind(iSymbol, "NASDAQ", 0) > 0) MagicNumber = 250;
  if (StringFind(iSymbol, "SP500", 0) > 0) MagicNumber = 260;
  if (StringFind(iSymbol, "SILVER", 0) > 0) MagicNumber = 270;

// add more here if needed
  
  if( MagicNumber == 0 ) { MagicNumber = 1000; }  // default

  if (Period()== PERIOD_MN1) {MagicNumber=MagicNumber +9;}  
  else if (Period()== PERIOD_W1)  MagicNumber=MagicNumber +8;
  else if (Period()== PERIOD_D1)  MagicNumber=MagicNumber +7;
  else if (Period()== PERIOD_H4)  MagicNumber=MagicNumber +6;
  else if (Period()== PERIOD_H1)  MagicNumber=MagicNumber +5;
  else if (Period()== PERIOD_M30) MagicNumber=MagicNumber +4;
  else if (Period()== PERIOD_M15) MagicNumber=MagicNumber +3;
  else if (Period()== PERIOD_M5)  MagicNumber=MagicNumber +2;
  else if (Period()== PERIOD_M1)  MagicNumber=MagicNumber +1;
  else MagicNumber=MagicNumber + 1010;

  MagicNumber = MagicNumber + ((MagicBase + AccountNumber())/111); // divide by 111 or whatever
   
return (MagicNumber);
}

 

Of course you only need to call this function one time in the init section of your code..

 

SetMagicNumber();

 

Have Fun...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...