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

Re: [amibroker] Re: LineArray Questions



PureBytes Links

Trading Reference Links

Very few people here are programmers but one way or another it is picked up - usually by "learning by doing."  You demonstrated that you have enough AFL under your belt to tackle this problem.  However, you have to get a couple of things straightened out. 
 
What you wrote is not the code for the variables H and LH.  First of all it should have the form of an equation.  So, H = ???? in the case of H and LH = ???? for LH.  If this all sounds like gibberish, there is no alternative to spending some time studying the basics of coding in a book or Users Guide (e.g., http://www.amibroker.com/guide/h_understandafl.html and http://www.amibroker.com/guide/a_language.html).
 
First, how is H defined?  The figure says that H is a bar that "closed above the previous bar high."  How do you say that in AFL? 
 
H = C > Ref(H, -1);
 
Now in a similar manner how do you define LH and HH?  Write it out in words just like the chart shows for H and then translate it into AFL.
 
LH = ????????????
HH = ???????????
 
Once you do that plot the results using different colors for each condition:
 
color = iif(h, colorred, iif(lh, colorwhite, iif(hh, colorblue, colorgreen)));
 
plot(c, "", color, stylebar);
 
A total of five lines of code up to this point.  Next run the code and check the chart to be sure that all of the H, HH, and LH bars that you identify by eye are properly colored.  If not, go back to the code and fix it until the colors are right.  At this point, the essence of the information that you want is displayed on the chart.  Once you get that far you can decide whether or not enhancements such as lines are needed.
 
Bill
 
----- Original Message -----
From: "Mohammed" <softnews2003@xxxxxxxxx>
Sent: Tuesday, March 11, 2008 4:05 PM
Subject: [amibroker] Re: LineArray Questions

> Hi Bill,
>
> I'm trying to use this condition for H and LH:
>
> Ref(H,-1) <= Ref(H,-2) AND H > Ref(H,-1) AND C > Ref(H,-1);
>
> I think this is the first point to get the LH.
>
> But I couldn't write the rest of the code as I Just start with
> AmiBroker code and I'm not programmer.
>
> Regards.
>
>
>
> --- In
amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@xxx>
> wrote:
>>
>> This is quite different from what you asked described.  You need to
> take a crack at writing a code that duplicates the picture.  Then
> perhaps someone can quickly look at your code and suggest changes. 
>>
>> You might consider starting by specifying the conditions that
> define H and LH.  It might help you during this phase to color H, LH,
> and other bars in a special way so that you can visually determine if
> your code is OK.  That's the key.  Once that is done, if you feel
> that lines are needed, using the approach that I gave you or
> something else add code that draws the different types of lines that
> you want.
>>
>> Bill
>>
>>
>> ----- Original Message -----
>>   From: Mohammed
>>   To:
amibroker@xxxxxxxxxxxxxxx
>>   Sent: Tuesday, March 11, 2008 2:52 PM
>>   Subject: [amibroker] Re: LineArray Questions
>>
>>
>>   Dear Bill,
>>
>>   Thank you very much for your help. And I'm sorry to not explain
> it good. Now I Do more explanation In the attached image. beside the
>>   following explanation.
>>
>>   1 . I would like to draw horizontal line from candle high, The
> line will start when we have a new "LH" Lower high.  "Point 1 and
> Point 2".
>>
>>   2. The Line that has a pink color showing in "Point1 and Point 2"
> I need it to move each day if we have new Lower High to new position.
>>
>>   3. The Line that has a blue color it indicate that the price
> closed above the previous pink line. and it should be showing and
> extended with bars till we have new Lower High. "Point 2".
>>
>>   This is the link for the Image.
>>
>>  
http://www.screenshots.cc/out.php/i2635_HorizontalLine2.gif
>>
>>   OR here:
>>
>>  
http://www.upload2world.com/pic78/upload2world_6e13a.gif
>>
>>
>>   Hopefully I clear it now
>>
>>   Regards,
>>
>>
>>
>>
>>
>>   --- In
amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@>
> wrote:
>>   >
>>   > I don't fully understand your explanation but I think I picked
> up the main thrust. If so, this is probably going in the right
> direction so you can modify as required.
>>   >
>>   > startHigh = SelectedValue(IIf(C < Ref(H, -1), Ref(H, -1), 0));
>>   >
>>   > startIndex = SelectedValue(BarIndex());
>>   >
>>   > endIndex = SelectedValue(BarIndex()) + 5;
>>   >
>>   > Plot(C, "", IIf(C > startHigh AND BarIndex() >= startIndex AND
> BarIndex() < endIndex, colorRed, colorPaleGreen),
> styleBar|styleThick);
>>   >
>>   > Plot(IIf(startHigh > 0 and BarIndex() >= startIndex and BarIndex
> () < endIndex, startHigh, Null), "",
>>   >
>>   > colorWhite, styleThick);
>>   >
>>   >
>>   >
>>   > Bill
>>   >
>>   > ----- Original Message -----
>>   > From: Mohammed
>>   > To:
amibroker@xxxxxxxxxxxxxxx
>>   > Sent: Sunday, March 09, 2008 3:57 PM
>>   > Subject: [amibroker] ineArray Questions
>>   >
>>   >
>>   > Hi All,
>>   >
>>   > //----------------------------------------------------
>>   >
>>   > Cond1 = Ref(H,-0);
>>   > period = 0;
>>   >
>>   > y0=LastValue(Peak(Cond1,period ,1));
>>   > y1=LastValue(Peak(Cond1,period ,0));
>>   > x0=BarCount - 1 - LastValue(PeakBars(Cond1,period ,2));
>>   > x1=BarCount - 1 - LastValue(PeakBars(Cond1,period ,0));
>>   >
>>   > Line = LineArray( x0, y0, x1, y1, 1 );
>>   >
>>   > Plot(C, "C", colorBlack, styleCandle);
>>   > Plot( Line, "Line", colorBlue,styleDots );
>>   >
>>   > //----------------------------------------------------
>>   >
>>   > With the above code I'm trying to plot horizontal line from
> yesterday candle high it will be extended to the right. I have
> question about some Adjustments.
>>   >
>>   > 1 . I need if the current candle close above the line the line
> didn't move to the next high. I need it to be extended to the right
> only till fifth candle close.
>>   >
>>   > 2 . When I ook to the chart it showing that the line start from
> the day before yesterday. And in some chart it is not linked to the
> highest of the candle it showing above the high.
>>   >
>>   > Any help will highly appreciated
>>   >
>>   > Regards.
>>   >
>>   >
>>   >
>>   >
>>   > ----------------------------------------------------------------
> --------------
>>   >
>>   >
>>   > No virus found in this incoming message.
>>   > Checked by AVG Free Edition.
>>   > Version: 7.5.516 / Virus Database: 269.21.7/1319 - Release
> Date: 3/8/2008 10:14 AM
>>   >
>>
>>
>>   
>>
>>
>> --------------------------------------------------------------------
> ----------
>>
>>
>>   No virus found in this incoming message.
>>   Checked by AVG Free Edition.
>>   Version: 7.5.516 / Virus Database: 269.21.7/1319 - Release Date:
> 3/8/2008 10:14 AM
>>
>
>
>
>
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>
http://www.amibroker.com/devlog/
>
> For other support material please check also:
>
http://www.amibroker.com/support.html

> 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:
>   
mailto:amibroker-digest@xxxxxxxxxxxxxxx
>   
mailto: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/

>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.21.7/1319 - Release Date: 3/8/2008 10:14 AM
>
>
__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___