Generating the MagicNumber - page 2

 

@ WHRoeder

ernest02 already state his decision. Please be sure to read fully all reply before clicking reply.

You are rushing without proper read.

 

I gat it, I'm not sure this is usefull :


 static string  FirstCurr[8]; static string  SecondCurr[8]; 
 
   
        FirstCurr[0]  = "USD";
        SecondCurr[0] = "USD";
        FirstCurr[1]  = "EUR";
        SecondCurr[1] = "EUR";
        FirstCurr[2]  = "GBP";
        SecondCurr[2] = "GBP";
        FirstCurr[3]  = "CHF";
        SecondCurr[3] = "CHF";
        FirstCurr[4]  = "JPY";
        SecondCurr[4] = "JPY";
        FirstCurr[5]  = "AUD";
        SecondCurr[5] = "AUD";
        FirstCurr[6]  = "CAD";
        SecondCurr[6] = "CAD";
        FirstCurr[7]  = "NZD";
        SecondCurr[7] = "NZD";
     
      
      int a = -1,b=-1;
     for( int i =0; i<=7;i++)
        { 
        if( StringSubstr( Symbol(),0,3) ==  FirstCurr[i] )
          {
          a = i*10;
          break;
       }}
      for( int j =0; j<=7;j++)
         { 
          if( StringSubstr( Symbol(),3,6) ==  SecondCurr[j] )
            {
             b = j;
             break;
            }
          }      
      int mn = a+b;
      
      Print( "magic ", (string) mn); 

//******************************************************************************
//oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
      if (FirstCurr == "USD")r = 0;
      if (FirstCurr == "EUR")r = 1;
      if (FirstCurr == "GBP")r = 2;
      if (FirstCurr == "CHF")r = 3;
      if (FirstCurr == "JPY")r = 4;
      if (FirstCurr == "AUD")r = 5;
      if (FirstCurr == "CAD")r = 6;
      if (FirstCurr == "NZD")r = 7;
   
      if (SecondCurr == "USD")s = 0;
      if (SecondCurr == "EUR")s = 1;
      if (SecondCurr == "GBP")s = 2;
      if (SecondCurr == "JPY")s = 4;
      if (SecondCurr == "AUD")s = 5;
      if (SecondCurr == "CAD")s = 6;
      if (SecondCurr == "NZD")s = 7;
      
      
      int Number = r*10 + s;
      
      Print ("MagicNumber is ",(string)Number );   
      
 
deysmacro:

@ WHRoeder

ernest02 already state his decision. Please be sure to read fully all reply before clicking reply.

You are rushing without proper read.

  1. I did
    ernest02:

    I have decided to abandon the generation of unique MagicNumbers and rather adjust my code according the recommendation given by GumRai, which is:

    "f 2. -  Check the magic number and the OrderSymbol and ignore any trade that is not the chart symbol"

    I agreed with GumRai and his decision and gave some links that could be helpful.
  2. Was your post helpful?