Simple Coding Help - No Promise.

trash

Well-Known Member
trash

LOL!!! Show me a person who can make a claim in topics that he does not know about ...

I don't know what offended you .... The comment I made was with respect to the default (most common) scanner code that was present before.

Since, you've not shown your AFL, all I can rely on is the param window. You've basically taken pains to create an elaborate scanner.
Kindly tell me the number of lines it takes. I manage to get most (if not all) same functionality in far fewer lines of Explorer.

I have no intent of criticizing your effort. Nevertheless, you prove the same thing that I asserted
What are you talking about? I'm not offended. I just told you that you are wrong. And I didn't say anything about which method was better than the other one. And my more comprehensive AFL got nothing to do with the fact that your general claims about data export in Scan mode are wrong.

And no there is not much code needed because

Scanner forces you into separate file
Wrong. Just change one character. ONE! And optionally add paramtoggle.

and you have to change code if you have to change interval
Wrong. Why do you have to change code if you change the interval? Simply write a correct code that works. I have never needed to change code if changing interval.

you can extract entire data in one file (or split using Filter);
You can do the same in Scan (and Explore of course) if auto-exporting to file. See reply to "Scanner forces you into separate file".

can control start and end dates
Again totally wrong about Scan mode not being able to do that. One line of code is needed. ONE! And then you can control start and end date in Auto analysis "Range" also if doing Scan. Wow, what a pain! Problem is you don't know the functions to do that. Hint: see Status() function.

What have I proven?? I don't understand.


Kindly tell me the number of lines it takes. I manage to get most (if not all) same functionality in far fewer lines of Explorer.
What number of lines in what code? If you are talking about my one. No, your one does not have most if not all functionality. And again FYI, writing a working code is a one time process and if you know what to do it's not a pain at all.

And in general kindly tell me the number of steps plus time it takes between manual and auto-export (both using basic code).
 
Last edited:

amitrandive

Well-Known Member
Amit, What does it do then?
Mastermind,

This scan explores the multiple time frame MA's where they are very near to each other and about to crossover,either on the positive or negative side.

This is a just another type of MA crossover scan but in this case it has MA's of different time frames.

Once properly filtered, we may get explosive trades in stocks or indices.Currently it only lists the stocks in the database with the difference of the EMA's of multiple time frame.

Thanks
Amit
 

mastermind007

Well-Known Member
What are you talking about? I'm not offended. I just told .......
trash

Show me the CODE!! Until that time, I will maintain that scanners require more code than explorers ...

If you do not want to show the code for any reason whatsoever, I have no issues with that. Until then Explorer version is best I've got and since it is available to everyone, it is the best others can have.
 

trash

Well-Known Member
trash

Show me the CODE!! Until that time, I will maintain that scanners require more code than explorers ...

If you do not want to show the code for any reason whatsoever, I have no issues with that. Until then Explorer version is best I've got and since it is available to everyone, it is the best others can have.

Oh well, here we go again.

Once again, you made a general statement claiming that scanner was not able to export multiple symbols to one file. Wrong, because just one change of one character is needed and no matter if scan or explore. Then you claimed that you have to change code every time you change interval. Wrong. And there was the claim that you can not control start and end dates via Range setting of Analysis. Wrong again, just one additional function is needed in the code. So in the end the basic code is the same being posted

That's all it is about. It is not about code length. It's about your general claims in your original statement about scanner capabilities. Either you get it or you don't get it.
 
Last edited:

manojborle

Well-Known Member
if you open all codes for default indis in AB, they are BLUE in color. tht means their construct is not given in formula code!

for example - for OBV:
_SECTION_BEGIN("OBV");
Plot( OBV(), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

but what is OBV? if take a crude logic of it (correct me if i am wrng)-

if the closing price is above the prior close price then:
Current OBV = Previous OBV + Current Volume
If the closing price is below the prior close price then:
Current OBV = Previous OBV - Current Volume
If the closing prices equals the prior close price then:
Current OBV = Previous OBV (no change)

this means a crude code sahud have price + volume in it which is in end term as OBV the default code!

i want to know the construct of tht crude code using price and volume for OBV & MFI!
xsis, I am really not getting what you need ?
i saw somewhere the code and it is also the same, what is written above.

For example,
if(C>Cprev) then OBV = OBVprev + Volume
and like that
 
Hello Friends

I am starting this thread for helping anyone who requires small changes in AFLs or AFL coding done for small / simple requirements that can be clearly defined.

What does not go is conversion . . . from Amibroker to anything else . . . or from anything else to Amibroker . . .

Debugging requested for copy/paste AFLs, Please don't post huge AFLs with zillions of lines of code for debugging

I will not be available for any conversions and I am not interested in debugging some-one else's copy/pasted work and lastly . . .
Not interested in hacking/craking any ones work . . .

Only if have a clearly definable task to be coded I maybe able to help . . . No Promises but will try within my limitations . . .


As an example, recently one of our friends wanted a motivational message to be included in his Charts,
I enjoyed doing that, as i could easily empathize with why he wanted that . . .


Cheers

:) Happy
Hello Happy Singh, It's really nice of you to start such an useful thread. I have been reading your comments and posts in different threads and found them quite useful. Just like your name, this thread made me really happy when I found it while desperately searching for a clue.
I have been trying to learn AFL for a few days seriously. I went through different functions and parameters and tried to understand them.
Just for learning purpose initially I tried to emulate the Stochastic indicator from scratch instead of using the inbuilt indicator and function. But sadly, I failed miserably. :(

As such, the inbuilt indicator uses %K and %D functions.
However, if we just follow the stochastic formula:
%K = (Current Close - Lowest Low)/(Highest High - Lowest Low) * 100
smoothed %K = 3-day SMA of %K
%D = 3-day SMA of smoothed %K

Stochastic AFL can be as follows:
_SECTION_BEGIN("newStochastics");
pds = Param( "Periods", 14, 1, 200, 1 );
HiHigh = HHV( Ref( H, -1 ), pds ); // Highest high value of highs in last 20 periods
LoLow = LLV( Ref( L, -1 ), pds ); // Lowest low value of low in last 20 periods
RangeS = HiHigh - LoLow;
StochsL = (Close - LoLow)/RangeS *100;
StochsK = Param( "StochsL avg", 3, 1, 200, 1 ); // smoothed StochsL or %K
StochsD = Param( "StochsK avg", 3, 1, 200, 1 ); // further smoothed StochsK
// Plots a 14 period Alamstochs
Plot( StochsK, "StochsK", ParamColor( "K Color", colorBlue ), ParamStyle( "K Style", styleLine ), 0, 100, 0 );
Plot( StochsD, "StochsD", ParamColor( "D Color", colorRed ), ParamStyle( "D Style", styleLine ), 0, 100, 0 );
Title = WriteVal( StochsK, 1.2 ) + WriteVal( StochsD, 1.2 );
_SECTION_END();

BUT END RESULT on the chart is ZERO. What am I doing wrong?
I guess, I couldnot correctly put the value of Current close. Am I using Close as an array instead?
Please guide, sir. Also, what should be right syntax, if I want EMA instead of simple avg? I will be grateful to you for any help. Thanks & Regards
 

pratapvb

Well-Known Member
Hello Happy Singh, It's really nice of you to start such an useful thread. I have been reading your comments and posts in different threads and found them quite useful. Just like your name, this thread made me really happy when I found it while desperately searching for a clue.
I have been trying to learn AFL for a few days seriously. I went through different functions and parameters and tried to understand them.
Just for learning purpose initially I tried to emulate the Stochastic indicator from scratch instead of using the inbuilt indicator and function. But sadly, I failed miserably. :(

As such, the inbuilt indicator uses %K and %D functions.
However, if we just follow the stochastic formula:
%K = (Current Close - Lowest Low)/(Highest High - Lowest Low) * 100
smoothed %K = 3-day SMA of %K
%D = 3-day SMA of smoothed %K

Stochastic AFL can be as follows:
_SECTION_BEGIN("newStochastics");
pds = Param( "Periods", 14, 1, 200, 1 );
HiHigh = HHV( Ref( H, -1 ), pds ); // Highest high value of highs in last 20 periods
LoLow = LLV( Ref( L, -1 ), pds ); // Lowest low value of low in last 20 periods
RangeS = HiHigh - LoLow;
StochsL = (Close - LoLow)/RangeS *100;
StochsK = Param( "StochsL avg", 3, 1, 200, 1 ); // smoothed StochsL or %K
StochsD = Param( "StochsK avg", 3, 1, 200, 1 ); // further smoothed StochsK
// Plots a 14 period Alamstochs
Plot( StochsK, "StochsK", ParamColor( "K Color", colorBlue ), ParamStyle( "K Style", styleLine ), 0, 100, 0 );
Plot( StochsD, "StochsD", ParamColor( "D Color", colorRed ), ParamStyle( "D Style", styleLine ), 0, 100, 0 );
Title = WriteVal( StochsK, 1.2 ) + WriteVal( StochsD, 1.2 );
_SECTION_END();

BUT END RESULT on the chart is ZERO. What am I doing wrong?
I guess, I couldnot correctly put the value of Current close. Am I using Close as an array instead?
Please guide, sir. Also, what should be right syntax, if I want EMA instead of simple avg? I will be grateful to you for any help. Thanks & Regards
you have not taken the 3period moving avg of it. you have only set the param

StochsK = Param( "StochsL avg", 3, 1, 200, 1 ); // smoothed StochsL or %K
StochsD = Param( "StochsK avg", 3, 1, 200, 1 ); // further smoothed StochsK

instead it should be

pK = Param( "StochsL avg", 3, 1, 200, 1 ); // smoothed StochsL or %K
pD = Param( "StochsK avg", 3, 1, 200, 1 ); // further smoothed StochsK

StochsK = ma(StochsL, pK) ;
StochsD = ma(StochsK, pD) ;


for ema use EMA instead of MA function
 
Dear Pratap, Thanks a lot for prompt help and pointing me in right direction. Oh, what a fool of me to set just period parameter and expecting ami to do the work of calculating moving average on its own. A silly mistake in real sense. Thanks for correcting me. Pratap, it was your immensely helpful and great thread on VWAP that inspired me to learn AFL properly. I am so grateful to you. I have been going through that thread on VWAP for some times quite religiously. I cannot say I understood all of your expert points, but I tried my best to abosrb them and still trying. Being from mathematical background, I also went back to refresh my knowledge about standard deviation aspects and all its features. In the course of my exploration, I also came across this thread on Trading With Market Statistics and the Volume Weighted Average Price (VWAP) at Trader Labs. You may find it interesting : http://www.traderslaboratory.com/fo...ing-market-statistics-i-volume-histogram.html. Thread writer Jperl also seems to be an expert on VWAP marketing strategy and incidentally he is also as generously helpful to newbies as you are. So fortunate for us.

Anyway coming back to my AFL learning: I succeeded in getting stochastic indicator from scratch this way. But a few points I still couldnot understand.
In the above mentioned formula, I have used:
pds = 14;
HiHigh = HHV( Ref( H, -1 ), pds ); // Highest high value of highs in last pds periods
LoLow = LLV( Ref( L, -1 ), pds ); // Lowest low value of low in last pds periods
Now when I use this formula instead: which i feel more straight forward
HiHigh = HHV(H, pds); // Highest high value of highs in last pds periods
LoLow = LLV(L, pds); // Lowest low value of low in last pds periods

In both cases cases I get almost same result. What is difference between them. Second set is also clearly clculating Highest High and Lowest Low over 14 days period.
In first set, it is referring to -1 or Previous Day High .. does it mean it is not taking into account Current bar's High? Which one is right according to Stochastic theory?

I also observe a weird thing: ideally stochastic being an oscillator, should move between between a certain range. Standard is 0-100. But inmy indicator case (using both the above formulas) I see stochastic value going as high as 119 and as low as -11. Something is wrong in my indicator formula. Isnt it? Please look at it too and point me in right direction.

I really admire traderji's great trio, Josh, you and happy singh for being so helpful to newbies and so generous and patient in sharing expertise. Notwithstanding Happy Sigh's Big B style pronouncement @ "Mere paas Manual hai" - I often find myself so confused and lost in the AFL jungle of the manual. In this respect, this thread has come as big boon to us. Please keep it up.
 
Last edited:

pratapvb

Well-Known Member
Anyway coming back to my AFL learning: I succeeded in getting stochastic indicator from scratch this way. But a few points I still couldnot understand.
In the above mentioned formula, I have used:
pds = 14;
HiHigh = HHV( Ref( H, -1 ), pds ); // Highest high value of highs in last pds periods
LoLow = LLV( Ref( L, -1 ), pds ); // Lowest low value of low in last pds periods
Now when I use this formula instead: which i feel more straight forward
HiHigh = HHV(H, pds); // Highest high value of highs in last pds periods
LoLow = LLV(L, pds); // Lowest low value of low in last pds periods

In both cases cases I get almost same result. What is difference between them. Second set is also clearly clculating Highest High and Lowest Low over 14 days period.
In first set, it is referring to -1 or Previous Day High .. does it mean it is not taking into account Current bar's High? Which one is right according to Stochastic theory?

I also observe a weird thing: ideally stochastic being an oscillator, should move between between a certain range. Standard is 0-100. But inmy indicator case (using both the above formulas) I see stochastic value going as high as 119 and as low as -11. Something is wrong in my indicator formula. Isnt it? Please look at it too and point me in right direction.
Don't use -1. Current close has to be compared with last n bar range including current bar else in BO /BD it will go out of range
 

Similar threads