Simple Coding Help - No Promise.

pratapvb

Well-Known Member
use

max(max(a,b), max(c,d))
 

dell

Well-Known Member
MACDcolor=IIf(a1b1>a1b1c1,colorGreen,IIf(a1b1c1>a1b1,colorOrange,colorDarkGrey));
Plot(10, "", macdcolor, styleNoLabel | styleOwnScale | styleArea, -1,20);

senior's,...............this is ribbon code , if we want to write " macd " on ribbon itself , than what is to be added in code , want to write on it as i have 5 ribbons , so not to get confused , i want to write name on ribbon itself .........is it possible in upper mentioned afl ?
plz take a look on this request .........
 
plz take a look on this request .........
dell for that use low level graphics functions, for e.g.

Code:
GfxSelectFont("Times New Roman", 8, 400, True ); 
GfxTextOut("MACD", 750 , 450 );
Adjust the x,y coordinates to match where you want to print

Also you can choose color etc,

For other functions look into amibroker help file, detail help is available

for e.g.

GfxTextOut
- writes text at the specified location Low-level graphics
(AFL 3.0)


SYNTAX GfxTextOut( ''text'', x, y )
RETURNS NOTHING
FUNCTION Writes a character string at the specified location using the currently selected font.

Parameters:

"text" - Specifies the character string to be drawn
x - Specifies the x-coordinate of the starting point of the text
y - Specifies the y-coordinate of the starting point of the text
Character origins are at the upper-left corner of the character cell. By default, the current position is not used or updated by the function.
The font used can be set using GfxSelectFont() function. Text color can be set using GfxSetTextColor() function.

If a formula needs to update the current position when it calls GfxTextOut, the formula can call the GfxSetTextAlign function with flags set to 1 (TA_UPDATECP Windows flag). When this flag is set, GfxTextOut function ignores the x and y parameters on subsequent calls to GfxTextOut, using the current position instead.

The output of this function is NOT clipped. If you want clip text to user-defined rectangle, use GfxDrawText() function instead.

NOTE: This is LOW-LEVEL graphic function. To learn more about low-level graphic functions please read TUTORIAL: Using low-level graphics.

EXAMPLE GfxSelectFont("Times New Roman", 16, 700, True );
GfxTextOut("Percent of shares held by:", 10 , 10 );

:) Happy
 

Nehal_s143

Well-Known Member
use

max(max(a,b), max(c,d))
Sir I used above max in afl, but I am getting wrong values



For testing I have used 3 day pivot range in old afl which can be used for max 4 days (bottom section in chart) & new max 8 days limit afl (top section) but the values are coming different

Bottom chart values are correct, I have checked manually.

Please suggest the solution
 
I have buy, sell, short & cover values. I want to display it in the title along with green or red color, which would change based on the values being hit or not. Please help with coding this. I don't know if the code below is correct or not but it would give an idea of what am trying to achieve.

Title = Name()+" "+Date()+" MHA -- MO:"+NumToStr(MO,1.2,True)+" / MH:"+NumToStr(MH,1.2,True)+" / ML:"+NumToStr(ML,1.2,True)+" / MC:"+NumToStr(MC,1.2, True)+"
Buy:"+iif(H>Long,encodecolor(colorgreen),encodecolor(colorred))+numtostr(Long,1.2,True)+" Sell:"+ iif(L<Longstop,encodecolor(colorred),encodecolor(colorgreen))+numtostr(Longstop,1.2,True)+
" Short:"+IIf(L<Sllshrt,EncodeColor(colorRed),EncodeColor(colorGreen))+NumToStr(Sllshrt,1.2,True)+" Cover:"+IIf(H>Shortstop,EncodeColor(colorGreen),EncodeColor(colorRed))+NumToStr(Shortstop,1.2,True)+" Lg Tgt:"+NumToStr(Longtarget,1.2,True)+" Sh Tgt:"+NumToStr(Shorttarget,1.2,True);
Please ignore this request, I've figured it out.

Thank you Happy Singh and Pratap, you guys were really helpful. :clapping:
 

chintan786

Well-Known Member
Hello Everyone,

I m looking for afl regarding watching OI only in Ami. Is there any code for the same. Inbuilt AFL in ami is not much of use as it remains straight line for any increase or decrease in OI.
 
Hello Everyone,

I m looking for afl regarding watching OI only in Ami. Is there any code for the same. Inbuilt AFL in ami is not much of use as it remains straight line for any increase or decrease in OI.
OI is a data field (similar to open,close or volume)

Amibroker will plot whatever you are getting from you data provider



:) Happy
 
Last edited:

Similar threads