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

[amibroker] Re: Woddies CCI



PureBytes Links

Trading Reference Links

//Hi there,
// In Section two I am trying to export to a file the symbol and
// other info only when a buy or sale is generated.. I cannot
// seem to get this code to work. I get no data generated in the file.
// If I remove the " if ( Sell[0] > 0 || Buy[0] > 0) " I get all
// symbols exported.
// Thanks in advance for your help. 


//
// Section 0ne.
// 
// DOUBLE STOCHASTICS EXPERT
// DoubleStocRay
// Basically, what I am trying to program the Expert to do is:

ATRn = 0.74;     
ADXp = 14; 

Filter = 0;
NumColumns = 1;

adjz = Param("Zig",10,0,15.0,.1);  // Param("Zig",10,0,15.0,.1); Orig

adjc = Param("Back",0,0,BarCount,1);
CAdj =  Ref(Close,-adjc);             // Param("Zig",03,0,05.0,.1);  

Graph1 = CAdj;
Graph0 = Zig( CAdj, adjz );

//==Buy==

//if THE CURRENT VALUE OF THE DBLSTOCH IS LESS THAN 40 AND GREATER 
THAN THE

//PREVIOUS DAYS VALUE THEN PAINT ONLY THIS BAR AS A Buy. (i.e.. the 
dblstoch is //below 40 AND has just turned up.)

//==Sell==

//if THE CURRENT VALUE OF THE DBLSTOCH IS MORE THAN 70 AND LESS THAN 
THE

//PREVIOUS DAYS VALUE THEN PAINT ONLY THIS BAR AS A Sell. (i.e.. the 
dblstoch //is above 70 AND has just turned down.)

//========

//Buy Highlight:

P1 = MA(((C-LLV(L,10))/(HHV(H,10)-LLV(L,10)))*100,3);

dblSto10 = MA(((P1-LLV(P1,10))/(HHV(P1,10)-LLV(P1,10)))*100,3);

Buy = dblSto10<40 AND dblSto10>Ref(dblSto10,-1) AND

Ref(dblSto10,-1)<Ref(dblSto10,-2)
AND (C > 12.00 AND C < 70.00 AND V > 1000 )
AND Ref(Graph0,-00) >= Ref((Graph1 + 0.00),-00) 
;

//Buy

//========

//Sell Highlight:

P1 = MA(((C-LLV(L,10))/(HHV(H,10)-LLV(L,10)))*100,3);

dblSto10 = MA(((P1-LLV(P1,10))/(HHV(P1,10)-LLV(P1,10)))*100,3);

Sell = dblSto10>70 AND dblSto10<Ref(dblSto10,-1) AND

Ref(dblSto10,-1)>Ref(dblSto10,-2)
AND (C > 12.00 AND C < 70.00 AND V > 1000 )
AND Ref(Graph0,-00) <= Ref((Graph1 + 0.00),-00) 
;
//
// Section two
//
// 
// Hi what I am trying to do here is export
// the SYMBOL and etc..to a file each time a buy or sell is generated.
// 
// thanks, RAY

if ( Sell[0] > 0 || Buy[0] > 0) 
  
 {
   fh = fopen( "c:\\SaveData\\"+Name()+".txt", "w") ; 

   if ( fh)
   {
   fputs( "Ticker,Date,Time,Open,High,Low,Close,Volume \n", fh )  ;
   y = Year(); 
   m = Month(); 
   d = Day(); 
   r = Hour();
   e = Minute();
   n = Second();

 
   for( i = 0; i < BarCount; i++ ) 
   { 
      fputs( Name() + "," , fh );
      ds = StrFormat("%02.0f-%02.0f-%02.0f,", 
                     y[ i ], m[ i ], d[ i ] ); 
      fputs( ds, fh ); 
     
      ts = StrFormat("%02.0f:%02.0f:%02.0f,", 
                     r[ i ],e[ i ],n[ i ] ); 
      fputs( ts, fh ); 

      qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n", 
                     O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] ); 
      fputs( qs, fh ); 
    } 

    fclose( fh );     
  } 
}
 

 





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/