StopLoss_MR=20.00000000 StopLoss_MR,F=1 StopLoss_MR,1=20.00000000 StopLoss_MR,2=1.00000000 StopLoss_MR,3=25.00000000
This show that in the optimizer you specified that the external variable StopLoss_MR should range from 20 to 25 in steps of one. The remainder code you posted does not reference the variable in question.
- I do not know where is the problem, this is the code:You do not specify a problem - there are no mind readers here.
int handle=_lopen (path,OF_READWRITE|OF_SHARE_COMPAT); if(handle<0) ... handle=_lopen (path,OF_READWRITE|OF_SHARE_COMPAT );
Why are you opening the file twice (if it succeeds) and losing the original handle?
With the function FileOpen/FileWrite/ FileClose, i have the desired result:
nas=0 ; a=0; b=0; c=11; MAX=c+1; ki=1; for(a = 0; a<1;a++) { for(b = 0; b<=0;b++) { for(c = 11; c<=12;c++) //MAX { File_set=Currency_data[a]+"_"+Strategy_data[b]+"_"+DoubleToStr(c,0)+".set"; string Strategy = StringSubstr (File_set,7,2); Print ("Strategy1",Strategy); if (Last_Strategy != Strategy){Import_var_set (Strategy);} Last_Strategy=Strategy; //MAX=ArraySize(PER); // SCRITTURA Set Print ("Val.std[ki]",PER[ki]+"-"+Val.std[ki]+"-"+Val.step[ki]); ArrayOpttim[1] = PER[ki]+"="+Val.std[ki]; ArrayOpttim[2] = PER[ki]+",F=1"; ArrayOpttim[3] = PER[ki]+",1="+DoubleToStr(StrToDouble(Val.std[ki])-(StrToDouble(Val.std[ki])*Perc.aum.var),8); ArrayOpttim[4] = PER[ki]+",2="+Val.step[ki]; ArrayOpttim[5] = PER[ki]+",3="+DoubleToStr(StrToDouble(Val.std[ki])+(StrToDouble(Val.std[ki])*Perc.aum.var),8); ki++; //------------------------------- Write data into the set file -------------------------- handle=FileOpen(File_set,FILE_CSV|FILE_WRITE|FILE_READ,';'); //Open a file to write FileSeek(handle,0,SEEK_END); for(int cnt=1; cnt<=ArraySize(ArrayOpttim); cnt++) FileWrite(handle,ArrayOpttim[cnt]); //20=arraysize(ArrayOptim) FileClose(handle); } } }
StopLoss_MR=20.00000000 StopLoss_MR,F=1 StopLoss_MR,1=5.00000000 StopLoss_MR,2=1.00000000 StopLoss_MR,3=35.00000000
But i need to save the file in to another folder (expert / files) and with the function _lread/_lwrite/_lclose:
nas=0 ; a=0; b=0; c=11; MAX=c+1; ki=1; for(a = 0; a<1;a++) { for(b = 0; b<=0;b++) { for(c = 11; c<=12;c++) //MAX { File_set=Currency_data[a]+"_"+Strategy_data[b]+"_"+DoubleToStr(c,0)+".set"; string Strategy = StringSubstr (File_set,7,2); Print ("Strategy1",Strategy); if (Last_Strategy != Strategy){Import_var_set (Strategy);} Last_Strategy=Strategy; //MAX=ArraySize(PER); // SCRITTURA Set Print ("Val.std[ki]",PER[ki]+"-"+Val.std[ki]+"-"+Val.step[ki]); ArrayOpttim[1] = PER[ki]+"="+Val.std[ki]; ArrayOpttim[2] = PER[ki]+",F=1"; ArrayOpttim[3] = PER[ki]+",1="+DoubleToStr(StrToDouble(Val.std[ki])-(StrToDouble(Val.std[ki])*Perc.aum.var),8); ArrayOpttim[4] = PER[ki]+",2="+Val.step[ki]; ArrayOpttim[5] = PER[ki]+",3="+DoubleToStr(StrToDouble(Val.std[ki])+(StrToDouble(Val.std[ki])*Perc.aum.var),8); ki++; //------------------------------- Write data into the set file -------------------------- int count=StringLen (buffer); string path=PathTester_set+File_set; int result; int handle=_lopen (path,OF_READWRITE|OF_SHARE_COMPAT); if(handle<0) { handle=_lcreat (path,0); if(handle<0) { Print ("Error creating file ",path); return; } // result=_lclose (handle); // } //handle=_lopen (path,OF_READWRITE|OF_SHARE_COMPAT ); //if(handle<0) // { // Print("Error opening file ",path); // return; // } result=_llseek (handle,0,SEEK_END); if(result<0) { Print("Error placing pointer"); return; } for(int cnt=1; cnt<ArraySize(ArrayOpttim); cnt++) { result=_lwrite(handle,ArrayOpttim[cnt],StringLen(ArrayOpttim[cnt])) ; if(result<0) Print("Error writing to file "); } result=_lclose (handle); //Print ("RESULT",result); if(result<0) Print("Error closing file ",path); } } }
and i have this result:
StopLoss_MR=0StopLoss_MR,F=1StopLoss_MR,1=5.00000000WHRoeder, thank's for your time.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello guys,
but i have this:i used the function in object for have this result:
I do not know where is the problem, this is the code:
Please, give me a advice.
thank's