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

[amibroker] Help for a thicko please.



PureBytes Links

Trading Reference Links

Hi,
I'm very new to AmiBroker and having a conceptual problem with the coding language.
 
I've implemented some code based on an alertif. However, I now want to extend it to do several additional things when the alert is triggered e.g. write to a file, plot shapes on the screen dependent on type of alert etc etc. Thus have described a loop in order to implement an if then else
 
I'm sure it's patently obvious - here is what I have so far
 
_SECTION_BEGIN ("Test");
z = CCI(14);
LSMA = LinearReg(C, 21);
EMA34 = EMA(C,34);
test2 = False;
// this alert works fine
AlertIf ( HHV(z,5) < 0 AND
 LLV(z, 5) < -100  AND Ref(z,-1) >-100 AND z < (Ref(z,-1)-5) AND Ref(z,-1) > Ref(z,-2)
 AND z >-130 AND C < EMA34 AND EMA34 < Ref(EMA34,-1) AND C < LSMA AND LSMA < Ref(LSMA,-1) ,
  "SOUND C:\\Program Files\\Ahead\\Nero\\Trumpet1.wav", "Audio alert", 1 );
 
// this gives error 6:
 
for (i = 34; i < BarCount; i++)
{
if (LLV(z[i],5) >0 AND  HHV(z[i], 5) > 100  AND z[i-1] <100 AND z[i] > z[i-1]+5 AND z[i-1] < z[i-2]
 AND z[i] <130 AND C[i]> EMA34[i] AND EMA34[i] > EMA34[i-1] AND C[i] > LSMA[i] AND LSMA[i] > LSMA[i-1])
{
test2 = True;
AlertIf(test, "SOUND C:\\Program Files\\Equis\\MetaStock\\Experts\\STB.wav", "Audio alert", 2 );
}
test2 = False;
}
 
_SECTION_END();
 
Grateful for a pointer in the correct direction


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 other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS