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

Re: [amibroker] Help for a thicko please.



PureBytes Links

Trading Reference Links

David Jennings -  LLV and HHV generate arrays and not single numbers. You can prove this to yourself by doing a plot or an explore.   When you make a comparison you need to decide what element of the price array or in this case LLV or HHV array you want to test against.

This compiles cleanly altho I don't know if it works.  Note the work around.  In the future you can use the large Check symbol in the Editor to get AB to do a syntax check and let you know if you have any syntax errors, then once that's clean you'll need to concern yourself if it executes properly and gives you the results you'd expect.

The code below, with 2 statements now compiles cleanly, you'll have to let me know if it executes properly.

Hope this helps

JOE

_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:

LLVArray = LLV(z,5);

HHVArray = HHV(z,5);

for (i = 34; i < BarCount; i++)

{

if (LLVarray[i] >0 AND HHVarray[i] > 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(test2, "SOUND C:\\Program Files\\Equis\\MetaStock\\Experts\\STB.wav", "Audio alert", 2 );

}

test2 = False;

}

_SECTION_END();

----- Original Message -----
Sent: Tuesday, February 28, 2006 10:07 AM
Subject: [amibroker] Help for a thicko please.

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