PureBytes Links
Trading Reference Links
|
Hallo Terry,
thanks for your notes and observations.
Because I programmed this algorithm in Delphi, I have me problems to
rewrite all in AFL.
The first part of the code are not important (calculation of iMin,
iMax and iDifference).
This is me first attempt to program in AFL.
Me problem is if I can use an second array how I descripted.
Your notes about the section
"Number of appareances"
and the "function ProfileAppareances(iDiff)"
are OK, but gives not an solution.
If you change this part and you write:
==============================================
/* Number of appareances */
function ProfileAppareances(iDiff)
{
for (i=nD-1; i<BarCount; i++)
{
nDiff=iDiff[i];
iApp[i]=iDiff[i];
}
return iApp;
}
==============================================
the plot
"Plot( ProfileAppareances(iDifference), ..."
are functioning and the differences are drawn whitout problems.
The "iApp" array will be used further from me, but I can't initialise
it or add simple values in this array, and I can not further
programed.
The problem is if I can define supplementary arrays or not.
Any example were helpful for me.
I tried some codes, but they are not functioning.
Regards
George
--- In amibroker@xxxxxxxxxxxxxxx, Terry <MagicTH@xxxx> wrote:
> I donšt follow exactly what you are trying to do, but I see some
syntax
> problems that may help you out. Please look in your code below for
my
> **notes**
>
> However, I don't see your subscript out of range. It appears
(without
> running the code) to be inbounds.
> --
> Terry
>
>
> From: socina@xxxx
> Reply-To: amibroker@xxxxxxxxxxxxxxx
> Date: Sun, 17 Oct 2004 17:35:55 +0200
> To: <amibroker@xxxxxxxxxxxxxxx>
> Subject: [amibroker] Problem with an second values array.
>
> Hallo,
>
> maybe can you help me to solve the following problem:
>
> For the i day:
> - I calculate the High and Low for the last 5 days
> - I calculate the difference between this values
>
> As example:
> iMax=150
> iMin=100
> Difference=iMax-iMin=50
>
> What I need is an array[1..50].
> All values are initial zero.
>
> For the last 5 days I need to increase for every day the array
value with 1,
> if the price are between the High and Low of this day.
>
> As example for Day 1:
> High=120, Low=110
>
> For i = 110 to 120 I must increase in the array the value at
position i-100
> with 1:
> array[110-iMin] = array[110-iMin]+1;
> ...
> array[120-iMin]=array[120-iMin]+1;
>
> The same addition is to calculate for the values between Open and
Close.
>
>
> My AFL code as Formula is:
> ==========================
>
> /*******************************************************************
> gs Market Pivots
> 10.17.2004
> *******************************************************************/
>
> _SECTION_BEGIN("Price");
> SetChartOptions(0,chartShowArrows);
> Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g,
> Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C,
1 ) ) );
> Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle |
> ParamStyle("Style", styleCandle, maskPrice ) );
> GraphXSpace=1;
> _SECTION_END();
>
>
> /*******************************************************************
> Market Pivots
> *******************************************************************/
> _SECTION_BEGIN("MarketPivots");
> nD=5; // Period
> iMult=100; // Multiplier
>
> // 1. Max, Min and Difference for the last nD days
> ............................
> for (i=nD-1; i<BarCount; i++)
> {
> /* Maximum prices for the "i" day */
> iMax[i]=H[i];
> //
> //**notes** you are setting iMax[I] = H[I]. You can do the same
before the
> loop and it runs faster: iMax = H; (no big deal)
> for (j=1; j<nD; j++)
> {
> if ( H[i-j] > iMax[i] )
> iMax[i] = H[i-j];
> else
> MaxOK = True;
> //**notes** attempt at using numeric variable inside loop has
always failed
> for me...try MaxOK[I]
> //**notes** also I don't see where you ever use MaxOK in which case
no ELSE
> portion is required.
> }
>
> /* Minimum prices for the "i" day */
> iMin[i]=L[i];
> for (j=1; j<nD; j++)
> {
> if ( L[i-j] < iMin[i] )
> iMin[i] = L[i-j];
> else
> MinOK = True;
> //**notes** attempt at using numeric variable inside loop has always
> // failed for me...try MinOK[I]
> //**notes** also I don't see where you ever use MinOK in which case
no
> // ELSE portion is required.
> }
>
> /* Difference maximum/minimum price for the "i" Day */
> iDifference[i] = (iMult*(iMax[i] - iMin[i]) + 1);
> //**notes* following code uses iDiff and not iDifference
> //**notes** possible problem with iMult without [I]
> // I know this should work, but it never works for me
> }
>
> Plot( iMax, "iMax", colorRed, styleNoTitle | styleLine) ;
> Plot( iMin, "iMin", colorBlue, styleNoTitle | styleLine);
>
>
> /* Number of appareances */
> function ProfileAppareances(iDiff)
> {
> for (i=nD-1; i<BarCount; i++)
> {
> nDiff=iDiff[i];
> //**notes** Diff not defined. You used Difference above
> for (j=1; j<=nDiff; j++)
> {
> iApp[j]=0;
> }
> // ...
> }
> return iApp;
> //
> //**notes** iApp is an array, return outside of loop. Actually this
is not
> defined as a function so you cannot return a result. The result
will just
> "be there" after the loop is finished. I don't see where iApp is
used
> anywhere.
> }
>
> // Test plot:
> Plot( ProfileAppareances(iDifference), "iDiff", colorYellow,
styleNoTitle |
> styleLine) ;
> _SECTION_END();
>
> =========================
>
> - Because I become the message:
> "Error 7.
> Subscript out of range",
>
> I can't continue with the code writing.
>
> Regards
> George
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
>
<http://us.ard.yahoo.com/SIG=12936tbj6/M=315388.5497957.6576270.300117
6/D=g
>
roups/S=1705632198:HM/EXP=1098113764/A=2372354/R=0/SIG=12id813k2/*http
s://ww
> w.orchardbank.com/hcs/hcsapplication?
pf=PLApply&media=EMYHNL40F21004SS>
>
>
> 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
> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
> *
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service
> <http://docs.yahoo.com/info/terms/> .
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/
|