PureBytes Links
Trading Reference Links
|
SPAM: -------------------- Start SpamAssassin results ----------------------
SPAM: This mail is probably spam. The original message has been altered
SPAM: so you can recognise or block similar unwanted mail in future.
SPAM: See http://spamassassin.org/tag/ for more details.
SPAM:
SPAM: Content analysis details: (5.40 hits, 5 required)
SPAM: USER_AGENT (-0.5 points) Found a User-Agent header
SPAM: FROM_ENDS_IN_NUMS (0.9 points) From: ends in numbers
SPAM: ALL_CAP_PORN (1.2 points) BODY: Possible porn - in ALL CAPS
SPAM: TO_BE_REMOVED_REPLY (0.4 points) BODY: Says: "to be removed, reply via email" or similar
SPAM: SPAM_PHRASE_01_02 (0.5 points) BODY: Spam phrases score is 01 to 02 (low)
SPAM: [score: 1]
SPAM: SUPERLONG_LINE (0.0 points) BODY: Contains a line >=199 characters long
SPAM: DATE_IN_PAST_96_XX (1.5 points) Date: is 96 hours or more before Received: date
SPAM: FORGED_YAHOO_RCVD (1.4 points) 'From' yahoo.com does not match 'Received' headers
SPAM:
SPAM: -------------------- End of SpamAssassin results ---------------------
Hi,
I'm used to programming C during my years in university, but it's been a while and by all means, I'm not an expert. I've been seriously working on this for a couple of days and I cannot get a grip on it. I went through the tutorials, references, etc.
What I am trying to accomplish is rather simple:
Count the number of EMA crossovers (upcross in this case), create an array that's 1 at multiples of 3 corssovers(so to say after each 3rd crossover array=1), otherwise the array is 0.
Well, it goes like this:
EMA1=EMA(C,10);
EMA2=EMA(C,200);
Plot(EMA1,"EMA10", colorRed,styleLine);
Plot(EMA2,"EMA20",colorBlue,styleLine);
Buycross[0]=0;
exit[0]=0;
threshold=3;
multiplier=1;
Buycross= Cross(EMA1,EMA2);
Counter=Cum(Buycross); //<== Here the crossover are counted with CUM
// start loop
for(i=0; i<BarCount;i++)
{
if (Counter[i]==threshold*multiplier)
{
multiplier++ AND exit[i]=1; // "AND"-statement?!?!
}
}
printf("buycross:\n");
WriteVal(Buycross,1);
printf("counter:\n");
WriteVal(Counter,1);
printf("multiplier:\n");
WriteVal(multiplier,1);
printf("exit:\n");
WriteVal(exit,1);
Counter here is an array, as opposed to the 2nd example. Looks strange, but works.
Fine you might say, he did his job, so what's he asking for?
I only achieved this by some means of trial and error and I don't understand, why I have to add "AND" in the loop.So to say, I don't understand what I did. Ok, check this:
EMA1=EMA(C,10);
EMA2=EMA(C,200);
Plot(EMA1,"EMA10", colorRed,styleLine);
Plot(EMA2,"EMA20",colorBlue,styleLine);
Buycross[0]=0;
exit[0]=0;
COUNTER=0; //<==== Integer, variable
threshold=3;
multiplier=1;
Buycross= Cross(EMA1,EMA2);
// start loop
for(i=0; i<BarCount;i++)
{
if (buycross[i]==0)
{
counter++; //<=== simple increment
}
if (Counter==threshold*multiplier)
{
multiplier++; //<=== The two statements without AND
exit[i]=1; //<=== don't seem to work
}
}
printf("buycross:\n");
WriteVal(Buycross,1);
printf("counter:\n");
WriteVal(Counter,1);
printf("multiplier:\n");
WriteVal(multiplier,1);
printf("exit:\n");
WriteVal(exit,1);
Eventhough my varible "counter" is initialized, the loop would simply not do the increment. Like this, I cannot loop the process of crossover counting. "counter" goes from 2 to 5, sometimes it's doing nothing or even DEcreases. BTW, I'm checking every value of my OHLCV array from the interpretation window.
Also, the 2 statements would not be executed properly without the AND. I finally accomplished my task in the first code but I do not understand how AFL treats the variables / arrays in a loop. I believe I am not the first one to experience this problem and I would appreciate any kind of help or explanation. I just know that the 2nd code in C would rather work.
I considered varget, global varibale, but the problem didn't seem to get resolved. What am I missing? Where should I look to read up on this?
Thanks,
Matthias
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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:
amibroker-digest@xxxxxxxxxxxxxxx
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/
|