Simple Coding Help - No Promise.

Hi,
Firstly, thanks you very much because of helping
Secondly, im completely new

I want to run back test
Sell when price decrease 10% compare to buy price or decrease 10% compare to highest price in last 10 day

please help me this afl code for ami
thanks a lot
 

vijkris

Learner and Follower
Hi,
Firstly, thanks you very much because of helping
Secondly, im completely new

I want to run back test
Sell when price decrease 10% compare to buy price or decrease 10% compare to highest price in last 10 day

please help me this afl code for ami
thanks a lot
bro, I m an amateur in coding, still, few doubts in ur strategy.
1. only sell, no buy? that means is it short only strategy?
2. "Sell when price decrease 10% compare to buy price ", how can buy price be defined without buying anything? :annoyed: :confused:
3. Is this strategy applicable for intraday charts or daily charts? :confused:
4. for backtesting u need to define ur exit criteria also, it is missing :annoyed::annoyed:
 

cloudTrader

Well-Known Member
Experts Please Help On A Code for a Spread Line based on this condition:

SPREAD = (LastA/CloseA) – (LastB/CloseB)

Where

LastA = LTP of Stock A

CloseA= Yesterday Close of Stock A

LastB = LTP of Stock B

CloseB = Yesterday Close of Stock B


Thanks !!

PS: Can you please confirm Plotting such a Spread Line is possible or not?
Any help !! Is this condition plotting possible in Amibroker? I read this condition for some other software[most probably Trade Station].

Thanks.
 

KelvinHand

Well-Known Member
Any help !! Is this condition plotting possible in Amibroker? I read this condition for some other software[most probably Trade Station].

Thanks.
In order to attract the programmers to help you.
So can you provide more information ?
"Most probably Trade Station."
To further evaluate the possibility in Amibroker.


The best also include May 2002 issue of Technical Analysis of STOCKS & COMMODITIES
"Using Volatility And Correlation
Daytrading Stock Pairs
by Mark Conway and Aaron Behle"
Article
 
Last edited:

cloudTrader

Well-Known Member
In order to attract the programmers to help you.
So can you provide more information ?
"Most probably Trade Station."
To further evaluate the possibility in Amibroker.


The best also include May 2002 issue of Technical Analysis of STOCKS & COMMODITIES
"Using Volatility And Correlation
Daytrading Stock Pairs
by Mark Conway and Aaron Behle"
Article
Thanks for the information. :clapping:

I noted the formula long time back from a blog. Only formulas were given. Nothing described regarding Article you have mentioned.

Can this be plotted in Amibroker ?

PS: Coding is an unknown territory for me ,, :eek:

Thanks & Regards.
 
Last edited:

KelvinHand

Well-Known Member
Thanks for the information. :clapping:

I noted the formula long time back from a blog. Only formulas were given. Nothing described regarding Article you have mentioned.

Can this be plotted in Amibroker ?

PS: Coding is an unknown territory for me ,, :eek:

Thanks & Regards.
Please show the blog.
PS: Given more information for the programmer will make thing more easy.
If you don't make thing easy for the programmer, why the programmer want to entertain you.
They are doing thing FOC
 
Last edited:

cloudTrader

Well-Known Member
Can anyone elucidate how to combine two conditions fulfilled separately in two successive candles or in candles with some gap in between, for example, when a scrip crosses low of bollinger band and after a while a low pivot is formed a little later or vice versa.
 

KelvinHand

Well-Known Member
Well Done!!!

Let see any programmer will help you.

I need to digest the code.
After evaluating the code, found that the TradeStation not that easy to convert to Amibroker. Cause CoefficientR() function is private to TradeStation. Not many programmer able to do it. so the R is automatic calculated.

For easy way, here the Metastock Version, but you need to manually key in the R value.

PHP:
Length = Param("30 day historical volatility", 30, 3);
r=Param("Correlation coefficient of these securities",0.5,0,100);
Vf=Param("Volatility factor",1.5, 0,5);
Ticker2= ParamStr("2nd Ticker to Compare", "D05");

p1= C;
p2= Foreign(Ticker2, "Close");

hv1=StDev(Log(p1/Ref(p1, -1)), Length);
hv2=StDev(Log(p2/Ref(p2, -1)), Length);

newday=ROC(DayOfWeek(),1) !=0;
yp1=ValueWhen(newday, Ref(p1,-1));
yp2=ValueWhen(newday, Ref(p2,-1));
sprd= (p1/yp1) - (p2/yp2);

vb=vf*(hv1 + hv2) * sqrt(1/252) * (1-r);
Plot(sprd, "Spread", colorAqua, styleNoLabel);
Plot(vb, "UpperVB", colorRed);
Plot(-vb, "LowerVB", colorLime);
PlotGrid(0,colorGrey50);
 
Last edited:

Similar threads