I'm bugging since three days on some Arrays Data's Transfer... Please a help to find my way ?

 

This is the problem :

I get an Array witch has collected the R/R of potentials trades . its name is "atd_RRCandid [Symbol] [SetUp] [TypeTrade]" .

I have to precise that the precedent function has transmit the real data (not relative one) , like in Function( string fsSymbol, int fiSetUp, Int fiTypeTrade);.

The EA  is running on the 28 Symbol,  it's parameters allowed 10 trades max (#define qiMaxTrade 10)  .

I would be allowed to select the 10 first R/R . so I've made a sort :  " ArraySort(atd_ RRCandid ,WHOLE_ARRAY,0,MODE_DESCEND);"  to collect the 10 best,


I thought to makes something like " for(int ref=0, ref<qiMaxTrade, ref++)"

Then I 'm stop, because I'ld like to transfer [real name Symbol] [real SetUp] [real TypeTrade] from the 0 to 9 first "atd_RRCandid [Symbol] [SetUp] [TypeTrade]" to 

 "bool atb_CandidToExec [Symbol] [SetUp] [TypeTrade]" but the relative rank has been changed with he sort..

(where atb_CandidToExec is collected after for running the MM calculations and gets final lot size to trade.)

I'm sure the solution is in front of my eyes but I don't see it,


a big thanks for who will give me the way of the light haha..


in hope, Kinds regards,


Daniel

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Other Constants
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Other Constants
  • www.mql5.com
Other Constants - Named Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

I'm having great difficulty trying to understand your explanation. Without understanding your question, it will be difficult to offer help.

You may also need to show more code of what it is you are trying to achieve. Remember to use the "</>" icon or Alt-S to add code to your post.

 
Daniel Murger: This is the problem :

I get an Array witch has collected the R/R of potentials trades . its name is "atd_RRCandid [Symbol] [SetUp] [TypeTrade]" .


I would be allowed to select the 10 first R/R . so I've made a sort :  " ArraySort(atd_ RRCandid ,WHOLE_ARRAY,0,MODE_DESCEND);"  to collect the 10 best,

  1. You are not collecting the 10 best of anything. You are sorting by Symbol.
  2. It is impossible to define "best" since the future is unknown.
 
Fernando Carreiro #:

I'm having great difficulty trying to understand your explanation. Without understanding your question, it will be difficult to offer help.

You may also need to show more code of what it is you are trying to achieve. Remember to use the "</>" icon or Alt-S to add code to your post.

Thanks you, I can Understand, I'll try to be shorter.

if(avd_RPerte!=0){atd_RRCandid[i][StUp][0] = avd_RGain/avd_RPerte;}

This, collects Risk Reward that has been calculated when a search market configuration has been found

for a Symbol [i] , a SetUP [StUP] for a buy [0].

At this point the results has been checked and are true.

My Ea is MultiSymbol , MultiSetUp , Multi Trade.I have to make an arbitrage  for selecting only a few of them &

those who show the best potential. So I have Tried to sort them, but as M. Roeder said, I have only sorted them by symbol, ( 1st problem).

after that,

I have to sort the R/R , then I have to transmit to the boolean's variables next if the atb_CandidToArbitr[i][s][t] is become a atb_CandidToExec[i][s][t].

I have to think other.

Thank you, I have to search like everybody here.

 
William Roeder #:
  1. You are not collecting the 10 best of anything. You are sorting by Symbol.
  2. It is impossible to define "best" since the future is unknown.

ho Yes, I had not checked the result yet, I thought the problem was somewhere else.

so it is worse now. I have to find how to sort their results and after that how marked the X 1st

"hypothetical"  winner , haha, triing to force the future.


Thank you

 

I think that I have fund out with your light, you've opened my  eyes.

Well, I'll test it today, hoping it's good.

Thanks you for your help.

This my code for that,  and as you could see on the two screenshots, the first screen show when it is not sort yet, then the second give them  sorted.

//. 
//>F48D_ArbitrageCandidat() 
//                                          
void F48D_ArbitrageCandidat()    
{//a                    
                if(Fbug==1) {ResetLastError();}

string ats_RRArbitr[]; ArrayResize(ats_RRArbitr,aqi_SB,aqi_MaxSB);
string asSetUp,asSymbol,asSens,asRR ; int aiChar,aiRR,aiSetUp,aiSens;


for(int i=0;i<aqi_SB;i++) 
    {//b
  for(int s=0;s<qiSetUp;s++)
      {//c
    for(int t=0;t<2;t++)
        {//d               
        if(atb_CandidToArbitr[i][s][t]==true )
          {//e
          asRR        =DoubleToString(atd_RRCandid[i][s][t],1);
          asSetUp     =IntegerToString(s,2);
          asSens      =IntegerToString(t);
          asSymbol    =ats_SB[i];
          if(Fbug==1){F04_Bug("F48_ArbitrageCandidat_Partie 1 _array ats_sb[i]");} if(Fbug==1) {ResetLastError();}
          ats_RRArbitr[i]=asRR+asSymbol+asSens+asSetUp;  
          aiChar      =StringLen(aiChar); //Nombre de caractères dans le String
          if(Fbug==1){F04_Bug("F48_ArbitrageCandidat_Partie 1 _array ats_RRarbitr]");} if(Fbug==1) {ResetLastError();}
          if(Fg48){Alert("F48D1_RRArbitr[i]= ",sp,ats_RRArbitr[i],sp,"Detail StringAdd =",sp,sp,asRR,sp,sp,asSetUp,sp,sp,asSens,sp,sp,asSymbol,sp,sp,"ToT Car= ",aiChar);}                                                                              
          }//ez
        }//dz
      }//cz
     }//bz
   ArraySort(ats_RRArbitr,WHOLE_ARRAY,0,MODE_DESCEND);
if(Fbug==1){F04_Bug("F48_ArbitrageCandidat_Partie 1 ");} if(Fbug==1) {ResetLastError();}
// end of sort 1st step , next is to get the x first, and retrieve who they are

for ( int r=0;r<qiMaxTrad;r++)
   {//e
for(i=0;i<aqi_SB;i++) 
    {//b
  for(s=0;s<qiSetUp;s++)
      {//c
    for(t=0;t<2;t++)
        {//d    
          if(ats_SB[i]==asSymbol)
          {//dd 
          if(Fbug==1){F04_Bug("F48_ArbitrageCandidat_Partie 2_asSymbol ");} if(Fbug==1) {ResetLastError();}
          int aiCharSymbol=StringLen(asSymbol);
          if(Fbug==1){F04_Bug("F48_ArbitrageCandidat_Partie 2_longueur ats_SB[i] ");} if(Fbug==1) {ResetLastError();}
          aiRR        =aiChar-(aiCharSymbol+2+1);  //trouve le nbre de caractère du RR en sachant: SetUp=2, Sens=1,Symbol=StringLen((ats_SB[0]).
          if(Fbug==1){F04_Bug("F48_ArbitrageCandidat_Partie 2_recup airr ");} if(Fbug==1) {ResetLastError();}     
          asSymbol    =StringSubstr(ats_RRArbitr[r],(aiChar-aiRR),aiCharSymbol);
          if(Fbug==1){F04_Bug("F48_ArbitrageCandidat_Partie 2_recup asSymbol ");} if(Fbug==1) {ResetLastError();}
          aiSens      =StringSubstr(ats_RRArbitr[r],(aiChar-aiRR-aiCharSymbol),1); 
          if(Fbug==1){F04_Bug("F48_ArbitrageCandidat_Partie 2_recup aiSens ");} if(Fbug==1) {ResetLastError();}
          aiSetUp     =StringSubstr(ats_RRArbitr[r],(aiChar-aiRR-aiCharSymbol-1),2);
          if(Fbug==1){F04_Bug("F48_ArbitrageCandidat_Partie 2_recup aiSetUp ");} if(Fbug==1) {ResetLastError();}

          atb_CandidToExec[i][s][t]=true; aqi_CandidToArbitr--; aqi_CandidToExec++;

          if(Fg48){Alert("F48D2_RRArbitr_aiChar=",aiChar,sp,"aiRR= ",aiRR,sp,"asSymbol= ",asSymbol,sp,"aiSetUp= ",aiSetUp,sp,"aiSens= ",aiSens,sp,"IsCandidToExec?=" ,
                         atb_CandidToExec[i][aiSetUp][aiSens]);}
          }//ddz
        }//dz
      }//cz
     }//bz
    }//ez

if(Fbug==1){F04_Bug("F48_ArbitrageCandidat");}
}//az
//<\_END_F48D_ArbitrageCandidat()__________________________________________________________________________________________________________________________________________________
Files:
 

That's not run... :-(

That doesn't Sort nothing. ..

In fact, ArraySort is not good.

above 10 ref for the Array[11+] , that send you an error array message.

and less than 10, MT4 run slowly and sometimes crash.

I had a 28 ref Array.. so eRR Message and no Sort


I 'll find an other way with some aiCount1 ++ when result will be above a certain amount1, or aiCount2 if above a certain amount2 and so on..

it will be faster and I could choose between 4 or 5 better result easily ..

Reason: