Simple Coding Help - No Promise.

Happy singh sir you shared inverted chart afl but there is no scaling on right side if you please rectify with scaling I need 10 point scale for nifty I will be thankful.
 

hmp

Well-Known Member
Will anybody add buy sell arrows along with scanning for the following Heiken Ashi afl?
Regards.
_SECTION_BEGIN("Heiken Ashi Smoothed");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack),ParamColor("Titleblock",colorLightGrey ));
SetChartOptions(0,chartShowArrows|chartShowDates);
GraphXSpace=5;
p=Param("Period",30,0,30,1);
Om=MA(O,p);
hm=MA(H,p);
lm=MA(L,p);
Cm=MA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
 
Hi,
I want to have an AFL which runs in 2 situation:
1- working by itself (as an indicator... showing something... having plot instruction...)
2- being called by another AFL (as a calculation... function... no plotting in called AFL...)

any Idea?
tnx
 

TracerBullet

Well-Known Member
Hi,
I want to have an AFL which runs in 2 situation:
1- working by itself (as an indicator... showing something... having plot instruction...)
2- being called by another AFL (as a calculation... function... no plotting in called AFL...)

any Idea?
tnx
i have not done this, but you can try to put your logic in function and keep it in separate file. plot specific stuff you can keep in separate afl. Then just use include
 
i have not done this, but you can try to put your logic in function and keep it in separate file. plot specific stuff you can keep in separate afl. Then just use include
thanks TracerBullet;
but this way every file will be converted to 2. one file for function and one file for plot.
problems:
1- hard to manage.
2- big number of files
=================
also I can have 1 big file in include folder for all functions
but again there is some problem...
I should find for functions, every time.
corruption of a function (i.e. missing "}" ) can effect on others
=================
I'm looking for a standard way.
what other people do.
 
I have sent a post here.
but I can't see it.
are my posts waiting for admin's watch???
no one send me PM me about this.
=================
any way...
I think I know the way.
I introduce a variable in the biginning of file IF:
if(typeof(variable)=="undefined")

it should work...
and maybe it is working...
but there is problems.

my files arrange are this:
1- trading system of macd
2- macd
3- moving averages
4- plots

I can show 1st and 4th but not 2nd.
 
i have not done this, but you can try to put your logic in function and keep it in separate file. plot specific stuff you can keep in separate afl. Then just use include
dear tracerBullet;
I've sent you another post and it's not here (I don't know why and how)
I had wrote on it that
your solution needs 2 times more files. and it causes secondary problem like problem of managing files and changing both or just one and... in breif it confuse programmer
=============
another way was to have a huge file that have all of functions in itself and in the include folder...
it has again some problems...
=============
best way is this that I have mentioned.
it's like this:

Code:
flag_stand_alone_TSMACD = False;

if( typeof( show_var ) == "undefined" )
{
    flag_stand_alone_TSMACD = True;
    show_var = C;
}
show_var is a var that is for 2 purpose:
1- showing, plotting...
2- as a flag to understanding if any other parent_file is calling this file or it is calling by the direct order of operator

I don't explain more. if anybody wants to know the procedure PM me. (I don't fallow this topic anymore)

just I should say after above code should be codes for including. like this:
Code:
// __________________________________________________________________________________________   گنجاندن کتابخانه ها
#include_once <mhj_show.afl>
#include_once <mhj_extermums.afl>
#include_once "E:\Program Files (x86)\AmiBroker\Formulas\MHJ\MHJ_MACD.afl"
and the form of include should be include_once
and direction of inclusion should be from most essential to the least

then it's place for the main function of this file. like this:
Code:
// _________________________ تابع اصلي
function MHJ_TS_MACD( input_array, Param_avg_kind, Param_fast_piriod, Param_slow_avg , Param_operand )
{

}
and at last instructions when file/function is working by itself. like this:

Code:
// _________________________  اجراي تنها
if( flag_stand_alone_TSMACD )
{
mhj_show(mhj_macd(Param_avg_kind, Param_fast_piriod, Param_slow_avg));
}
 
dear tracerBullet;
I've sent you another post and it's not here (I don't know why and how)
I had wrote on it that
your solution needs 2 times more files. and it causes secondary problem like problem of managing files and changing both or just one and... in breif it confuse programmer
=============
another way was to have a huge file that have all of functions in itself and in the include folder...
it has again some problems...
=============
best way is this that I have mentioned.
it's like this:

Code:
flag_stand_alone_TSMACD = False;

if( typeof( show_var ) == "undefined" )
{
    flag_stand_alone_TSMACD = True;
    show_var = C;
}
show_var is a var that is for 2 purpose:
1- showing, plotting...
2- as a flag to understanding if any other parent_file is calling this file or it is calling by the direct order of operator

I don't explain more. if anybody wants to know the procedure PM me. (I don't fallow this topic anymore)

just I should say after above code should be codes for including. like this:
Code:
// __________________________________________________________________________________________   گنجاندن کتابخانه ها
#include_once <mhj_show.afl>
#include_once <mhj_extermums.afl>
#include_once "E:\Program Files (x86)\AmiBroker\Formulas\MHJ\MHJ_MACD.afl"
and the form of include should be include_once
and direction of inclusion should be from most essential to the least

then it's place for the main function of this file. like this:
Code:
// _________________________ تابع اصلي
function MHJ_TS_MACD( input_array, Param_avg_kind, Param_fast_piriod, Param_slow_avg , Param_operand )
{

}
and at last instructions when file/function is working by itself. like this:

Code:
// _________________________  اجراي تنها
if( flag_stand_alone_TSMACD )
{
mhj_show(mhj_macd(Param_avg_kind, Param_fast_piriod, Param_slow_avg));
}
 
Hello
On one of the threads On Balance Volume is discussed
OBV() gives a cumulative figure of volume
Tried getting it for intraday i.e from start of the day

Code:
ND = Day()!=Ref(Day(),-1);				
Bars = BarsSince(ND)+1; // Bars Today
Ob = OBV();
ID_Ob = Ob - Ref(Ob,-Bars);
Plot(IIf(ND,Null,ID_Ob),"ID_OB",colorRed,styleThick);
Happy :)
 
Hello
On one of the threads On Balance Volume is discussed
OBV() gives a cumulative figure of volume
Tried getting it for intraday i.e from start of the day

Code:
ND = Day()!=Ref(Day(),-1);				
Bars = BarsSince(ND)+1; // Bars Today
Ob = OBV();
ID_Ob = Ob - Ref(Ob,-Bars);
Plot(IIf(ND,Null,ID_Ob),"ID_OB",colorRed,styleThick);
Happy :)
You are Awosome HAPPY. Would you mind helping other keltner bands afls as well in similar fashion as discussed in other thread
 

Similar threads