Simple Coding Help - No Promise.

amitrandive

Well-Known Member
hi
can you help me get this afl code for doji with conditions please
--------------------------------------------------------------------------------
Software code for the TradeStation Easy Language platform

This code is for the Doji pattern:

Vars: oFastK(0), oSlowK(0), oFastD(0), oSlowD(0);
Value1 = Stochastic(High, Low, Close, 12, 3, 3, 1, oFastK, oSlowK,
oFastD, oSlowD);

If AbsValue(Open - Close) <= Range * 0.1 Then
If Average(Volume, 90) > 200000 Then
If Close > 25 Then
If oSlowK < 20 Then
Plot1(Low, "Doji");
---------------------------------------------------------------
buycond =doji1
buy =IIF((abs(high -low)<= range*0.10 and c>=25 and ma(v,90)>=200000 and stochk(12,3)<20),plot(1,"1",colorred,stylebar);
The first line declares the variables that will be used in the code.
The second line calculates the Stochastic values.
The third line identifies the Doji pattern.
The fourth line requires that at least 200,000 shares of stock
have been traded (on average) for the last 90 days.
The fifth line will require the price to be above 25. This is done
for the purpose of being able to trade options on the stocks
that are found.
The sixth line requires that the stock be in an oversold
condition with the Stochastic below 20.
Be sure to reference oSlowK.
The last line identifies the bar as a Doji.
Before saving the code, it’s important to tell TradeStation how
the Doji will appear on a price chart. This is done under the
‘Properties’ selection under ‘Chart Style’. Make sure the Type is
set to Point. Also, there are 7 choices for Weight, choose at least
#4 or larger.
This code is saved and verified given the name Bigalow Doji.
=======================================
doji plot
idea is locate and find such doji by exploration and see it on chart as well.
Exploration only

Code:
Range=abs(High-Low);
Buy=Range<= (Range*0.10 )AND C>=25 AND MA(V,90)>=200000 AND StochK(12,3)<20 ;
PlotShapes (IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,-15);
Filter=Buy;
AddColumn(IIf(Buy,BuyPrice,Null)," Buy1 Signal ", 6.2,1.2,colorGreen);
AddColumn(Close,"Close",1.2);
 

extremist

Well-Known Member
Exploration only

Code:
Range=abs(High-Low);
Buy=[COLOR="Red"]Range<= (Range*0.10 )[/COLOR]AND C>=25 AND MA(V,90)>=200000 AND StochK(12,3)<20 ;
PlotShapes (IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,-15);
Filter=Buy;
AddColumn(IIf(Buy,BuyPrice,Null)," Buy1 Signal ", 6.2,1.2,colorGreen);
AddColumn(Close,"Close",1.2);
Bro tht can not be true ever.
how come the current range can be less than it's 1/10 th?
u can write it as Range<= (ref(Range,-1)*0.10 )

see if it could help....
 

amitrandive

Well-Known Member
Bro tht can not be true ever.
how come the current range can be less than it's 1/10 th?
u can write it as Range<= (ref(Range,-1)*0.10 )

see if it could help....
Thanks extremist
Can the modified code be as per your correction ?
Pleease verify.

Code:
Range=abs(High-Low);
Buy=Range<= (ref(Range,-1)*0.10 )AND C>=25 AND MA(V,90)>=200000 AND StochK(12,3)<20 ;
PlotShapes (IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,-15);
Filter=Buy;
AddColumn(IIf(Buy,BuyPrice,Null)," Buy1 Signal ", 6.2,1.2,colorGreen);
AddColumn(Close,"Close",1.2);
 

extremist

Well-Known Member
Thanks extremist
Can the modified code be as per your correction ?
Pleease verify.

Code:
Range=abs(High-Low);
Buy=Range<= (ref(Range,-1)*0.10 )AND C>=25 AND MA(V,90)>=200000 AND [COLOR="Red"][B]StochK(12,3)<20[/B][/COLOR] ;
PlotShapes (IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,-15);
Filter=Buy;
AddColumn(IIf(Buy,BuyPrice,Null)," Buy1 Signal ", 6.2,1.2,colorGreen);
AddColumn(Close,"Close",1.2);
he was saying Slow K
the K in amibroker is fast k
we can treat StochD as slow k

so this would be appropriate StochD(12,3)<20
 

extremist

Well-Known Member
He was saying
The fourth line requires that at least 200,000 shares of stock
have been traded (on average) for the last 90 days.


So MA(v,90) is wrong.
200000 he had mentioned. That is Cumulative Vol. not the bar volume.
if he runs the code on Daily chart then tht would be ok.
but work with Intra day following code should work.

Code:
Dayv = TimeFrameGetPrice("V", inDaily, -1);		
Range=abs(High-Low);
Buy=Range<= (ref(Range,-1)*0.10 )AND C>=25 AND MA(Dayv,90)>=200000 AND Stochd(12,3)<20 ;
PlotShapes (IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,-15);
Filter=Buy;
AddColumn(IIf(Buy,BuyPrice,Null)," Buy1 Signal ", 6.2,1.2,colorGreen);
AddColumn(Close,"Close",1.2);
Now this looks finished job.
 

rvlv

Active Member
HI Amitrandive

THanks.
it seems there is some hitch in this code.
it doesnt produce any results on eod stocks.
200000 is volume on every day for past 90 days.
in short,if we take 90 day average volume,it must be more than 200000 on any day.

see my code-it gives data to verify using the column results
it shows date of doji forming,value of stoch and volume on that day
=====================================
HTML:
//bigdoji = abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=5 AND C>25 AND StochK(12,3)<20 ;//FOR FUTURES
bigdoji = abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=200 AND C>25 AND StochK(12,3)<20 ;//FOR STOCKS


//Filter= abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=200 AND C>25 AND StochK(12,3)<20 ;//STOCKS
Filter= abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=200 AND C>25 AND StochK(12,3)<20 ;//FUTURES

AddColumn(Close,"close",1.2);
AddColumn(bigdoji," bigdoji",1.2);

AddColumn(MA(V,90)/1000,"MAV90",1.0);
AddColumn(StochK(12,3),"StochK(12,3",1.2);
AddColumn(EMA(C,8),"EMA(C,8)",1.2);
regards
rvlv
 

rvlv

Active Member
Afl for low risk entry

A research on gamblers that repeatedly loose led to a conclusion that these guys loose 25 times in a stretch.

with traders same is true.
we say worst traders loose 26 times in a row.
After that,if still alive,gains will be theirs.

now dont say then what?

a researcher found if , if one can trade with a risk of 0.31% on each trade,then he will not only survive but break others accounts by grabbing their profits too.

I asked so called experts and specialists,how much to risk on a trade?
they replied 2 %. or else I cant wont and you too shouldn,t trade.
(I felt have I asked an a-- hole?)
after 25 dumbtrades,he would be left over with hardly 35% capital. as good as 2/3 rds dead goat.
Asking dumb guys like these takes me nowhere- no where.

I at last found some dumb solutions.
If I talk of my dumb solution,it will disturb other experts original thought process.
Let our experts come out with an afl sooner or later.
I asked my friends-they said no way.
Of course there is a way
hints follow. Are you in such a big hurry?


what happens in the market? they make every body who buys to sell and get out.


how to go about it. see


the solution


People can try to understand. but most people choose to misunderstand soon.
 
Last edited:

amitrandive

Well-Known Member
HI Amitrandive

THanks.
it seems there is some hitch in this code.
it doesnt produce any results on eod stocks.
200000 is volume on every day for past 90 days.
in short,if we take 90 day average volume,it must be more than 200000 on any day.

see my code-it gives data to verify using the column results
it shows date of doji forming,value of stoch and volume on that day
=====================================
HTML:
//bigdoji = abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=5 AND C>25 AND StochK(12,3)<20 ;//FOR FUTURES
bigdoji = abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=200 AND C>25 AND StochK(12,3)<20 ;//FOR STOCKS


//Filter= abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=200 AND C>25 AND StochK(12,3)<20 ;//STOCKS
Filter= abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=200 AND C>25 AND StochK(12,3)<20 ;//FUTURES

AddColumn(Close,"close",1.2);
AddColumn(bigdoji," bigdoji",1.2);

AddColumn(MA(V,90)/1000,"MAV90",1.0);
AddColumn(StochK(12,3),"StochK(12,3",1.2);
AddColumn(EMA(C,8),"EMA(C,8)",1.2);
regards
rvlv
Did you try extremist code of post 3204?
 

amitrandive

Well-Known Member
Afl for low risk entry

A research on gamblers that repeatedly loose led to a conclusion that these guys loose 25 times in a stretch.

with traders same is true.
we say worst traders loose 26 times in a row.
After that,if still alive,gains will be theirs.

now dont say then what?

a researcher found if , if one can trade with a risk of 0.31% on each trade,then he will not only survive but break others accounts by grabbing their profits too.

I asked so called experts and specialists,how much to risk on a trade?
they replied 2 %. or else I cant wont and you too shouldn,t trade.
(I felt have I asked an a-- hole?)
after 25 dumbtrades,he would be left over with hardly 35% capital. as good as 2/3 rds dead goat.
Asking dumb guys like these takes me nowhere- no where.

I at last found some dumb solutions.
If I talk of my dumb solution,it will disturb other experts original thought process.
Let our experts come out with an afl sooner or later.
I asked my friends-they said no way.
Of course there is a way
Can we know what is the intention of this post?
Sharing or bragging or what ?
If you intend to share you would have surely not made such a post.
 
Last edited:

amitrandive

Well-Known Member
HI Amitrandive

THanks.
it seems there is some hitch in this code.
it doesnt produce any results on eod stocks.
200000 is volume on every day for past 90 days.
in short,if we take 90 day average volume,it must be more than 200000 on any day.

see my code-it gives data to verify using the column results
it shows date of doji forming,value of stoch and volume on that day
=====================================
HTML:
//bigdoji = abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=5 AND C>25 AND StochK(12,3)<20 ;//FOR FUTURES
bigdoji = abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=200 AND C>25 AND StochK(12,3)<20 ;//FOR STOCKS


//Filter= abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=200 AND C>25 AND StochK(12,3)<20 ;//STOCKS
Filter= abs(Open -Close)<= (H-L)*0.1 AND (MA(V,90)/1000)>=200 AND C>25 AND StochK(12,3)<20 ;//FUTURES

AddColumn(Close,"close",1.2);
AddColumn(bigdoji," bigdoji",1.2);

AddColumn(MA(V,90)/1000,"MAV90",1.0);
AddColumn(StochK(12,3),"StochK(12,3",1.2);
AddColumn(EMA(C,8),"EMA(C,8)",1.2);
regards
rvlv
It seems you can code in AFL , then why the request in the help section ?
 

Similar threads