--- In [email protected], "ccie8340tx" <[EMAIL PROTECTED]> wrote:
>
> Folks:
>
> Say I have AFL to write orders to csv file. Now I would include to
a LOOP to write TEN orders in increment of 10 pips.
> so that orders are generated as follows 1.4610, 1.4620,1.4630 and so
on upto 1.4710
>
>
> Buystop_Startvalue=1.4610
> Ten_pips=0.0010;
>
> I need a loop that would increment Strategy4_BuyStopEntry by 10 pips
and execute the below code so that I have 10 sequential orders.
>
>
> Below is the code to write orders to a csv file:
>
> if( LastValue(NewBar_Started) AND
LastValue(Ref(Strategy4_4Hour_Buy,-1)) )
> {
> mvOrderOIF =
> "\n"+
> Broker_Symbol+
> ","+ "BUYSTOPLIMIT" +
> ","+ (Strategy4_BuyStopEntry) +
> "\n";
>
> filepath="C:\\Program
Files\\Amibroker\\AFL\\PADHU\\AT\\MIG_0011_ORDERS.txt";
> filehandle=fopen(filepath, "a");
> fputs(mvOrderOIF, filehandle);
> fclose(filehandle);
>
> filepath="C:\\Program
Files\\Amibroker\\AFL\\PADHU\\AT\\MIG_0011_ORDERS_LOG.txt";
> filehandle=fopen(filepath, "a");
> fputs(mvOrderOIFLog, filehandle);
> fclose(filehandle);
>
> fileischanged=1;
>
> };
>
> so that the resulting file looks like
> EURUSD,BUYSTOPLIMIT,1.4610
> EURUSD,BUYSTOPLIMIT,1.4620
> EURUSD,BUYSTOPLIMIT,1.4630
>
> ....
>
> ....
> EURUSD,BUYSTOPLIMIT,1.4710
>
> Thanks,Padhu
>
Sample loop
s="";
BuyStop=1.4600;
for( i = 0; i < 11; i++ )
{
buyStop=buyStop+.0010;
s = s+StrFormat("EURUSD,BUYSTOPLIMIT,%1.4f\n",buyStop);
}
filepath="MIG_0011_ORDERS.txt";
Output = fopen( filepath, "w");
fputs( s, Output );
fclose(Output);
Bill