[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Can somehelp help with a LOOP here ?



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "ccie8340tx" <ccie8340tx@xxx> 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



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/