Recent Posts

Pages: [1] 2 3 ... 10
1
Amibroker Help / How to look at my last signal and take a decision in future
« Last post by tiasamik on December 12, 2017, 03:23:58 am »
I was trying to implement stochastics cross as a signal along with when stochK cross 20. I wrote AFL like -

///
Buy=cross(stochk(15,2),stochD(15,2,2)) and stochk(15,2)>20;
///

This has a problem. above AFL provides signal only when StochK value is greater than 20 and a Stchk StchD cross is happening. But it can not work when a cross of stochK & stochD happens below 20 and after few bars stochK increases and cross 20. I want to get signal also, when cross of K & D is happening below 20 level and when stochK cross 20. can any one help?
2
Amibroker Help / Weekly Autocorrelation Periodogram on a Daily Amibroker Chart
« Last post by derek2209 on November 30, 2017, 04:33:14 pm »
Hi
Is it possible  plot a  Weekly  "Autocorrelation Periodogram " ( John F. Ehlers)
on a separate  pane of a Daily Amibroker Chart ?
Link to  Autocorrelation Periodogram code below:

https://www.wisestocktrader.com/indicators/4665-john-f-ehlers-autocorrelation-periodogram-for-amibroker-afl

Thanking you in advance
Best regards
Derek

Code: [Select]
// Downloaded From www.WiseStockTrader.com
/*
Autocorrelation Periodogram
2013 John F. Ehlers
*/

SetBarsRequired(sbrAll);

LPeriod = Param("Low-pass Period", 10, 3, 20);
HPeriod = Param("High-pass Period", 48, 22, 80);
IsPlotHeatMap = ParamToggle("Show HeatMap?", "No|Yes", 1);
IsPlotDominantCycle = ParamToggle("Show Dom. Cycle?", "No|Yes");

pi=3.1415926;

function RoofingFilter(lpPeriod, hpPeriod)
{
alpha1 = (cos(0.707*2*pi / hpPeriod) + sin(0.707*2*pi / hpPeriod) - 1) / cos(0.707*2*pi / hpPeriod);
a1 = exp(-1.414*pi / lpPeriod);
b1 = 2*a1*cos(1.414*pi / lpPeriod);
c2 = b1;
c3 = -a1*a1;
c1 = 1 - c2 - c3;

HP = Close;
Filt = HP;

for(i = 2; i < BarCount; i++)
{
HP[i] = ((1 - alpha1 / 2)^2)*(Close[i] - 2*Close[i-1] + Close[i-2]) + 2*(1 - alpha1)*HP[i-1] - ((1 - alpha1)^2)*HP[i-2];
Filt[i] = c1*(HP[i] + HP[i-1]) / 2 + c2*Filt[i-1] + c3*Filt[i-2];
}

return Filt;
}

function AGC(lowerCutoff, higherCutoff, acceptableSlope)
{
factor = 0;
accSlope = -acceptableSlope; //acceptableSlope = 1.5 dB
halfLC = lowerCutoff / 2;
halfHC = higherCutoff / 2;
ratio = 10^(accSlope/20);
if(halfHC - halfLC > 0)
factor = ratio^(1/(halfHC - halfLC));
return factor;
}

function AutocorrelationPeriodogram(data, isHeatMap, isDomCyc)
{
avgLength = 3;
dominantCycle = 0;

//Pearson correlation for each value of lag
for(lag = 0; lag <= 48; lag++)
{
//Set the average length as M
M = avgLength;
if(avgLength == 0)
M = lag;
//Initialize correlation sums
Sx = 0;
Sy = 0;
Sxx = 0;
Syy = 0;
Sxy = 0;
//Advance samples of both data streams and sum Pearson components
for(count = 0; count <= M-1; count++)
{
X = Ref(data, -count);
Y = Ref(data, -(lag + count));
Sx += X;
Sy += Y;
Sxx += X^2;
Syy += Y^2;
Sxy += X*Y;
}
var1 = (M*Sxx - Sx^2)*(M*Syy - Sy^2);
VarSet("corr" + lag, IIf(var1 > 0, (M*Sxy - Sx*Sy)/sqrt(var1), 0)); //Compute correlation for each value of lag
//VarSet("corrScale" + lag, IIf(var1 > 0, 0.5*((M*Sxy - Sx*Sy)/sqrt(var1) + 1), 0)); //Scale each correlation to range between 0 and 1
}

/*//Plot as a Heatmap (for scale each correlation to range between 0 and 1)
for(period = 3; period <= 48; period++)
{
corr = VarGet("corrScale" + period);
Red = IIf(corr > 0.5, 255*(2 - 2*corr), 255);
Green = IIf(corr > 0.5, 255, 2*255*corr);
PlotOHLC( period-1, period-1, period, period, "", ColorRGB( Red, Green, 0 ), styleCloud | styleNoLabel);
}*/

/*
The DFT is accomplished by correlating the autocorrelation at each value of lag with the cosine and sine of each period of interest.
The sum of the squares of each of these values represents the relative power at each period.
*/
for(period = 10; period <= 48; period++)
{
cosinePart = 0;
sinePart = 0;

for(n = 3; n <= 48; n++)
{
cosinePart += VarGet("corr" + n)*cos(2*pi*n / period);
sinePart += VarGet("corr" + n)*sin(2*pi*n / period);
}
VarSet("sqSum" + period, cosinePart^2 + sinePart^2);
}

//EMA is used to smooth the power measurement at each period
for(period = 10; period <= 48; period++)
VarSet("r" + period, AMA((VarGet("sqSum" + period))^2, 0.2));

//Find Maximum Power Level for Normalization
K = AGC(10, 48, 1.5);
for(period = 10; period <= 48; period++)
{
if(period == 10)
VarSet("maxPwr", 0);
VarSet("maxPwr", IIf(VarGet("r" + period) > VarGet("maxPwr"), K*VarGet("r" + period), VarGet("maxPwr")));
}

//Normalization power
for(period = 10; period <= 48; period++)
VarSet("pwr" + period, VarGet("r" + period)/VarGet("maxPwr"));

//Compute the dominant cycle using the CG of the spectrum
Spx = 0;
Sp = 0;
for(period = 10; period <= 48; period++)
{
Spx += IIf(VarGet("pwr" + period) >= 0.5,  period*VarGet("pwr" + period), 0);
Sp += IIf(VarGet("pwr" + period) >= 0.5, VarGet("pwr" + period), 0);
}
dominantCycle = IIf(Sp != 0, Spx / Sp, 0);

if(isHeatMap)
{
//Plot as a Heatmap
for(period = 10; period <= 48; period++)
{
pwr = VarGet("pwr" + period);
Red = IIf(pwr > 0.5, 255, 2*255*pwr);
Green = IIf(pwr > 0.5, 255*(2*pwr - 1), 0);
PlotOHLC( period-1, period-1, period, period, "", ColorRGB( Red, Green, 0 ), styleCloud | styleNoLabel, Null, Null, 0, 0);
}
}

if(isDomCyc)
Plot(dominantCycle, "Dominant Cycle", colorBlue, styleThick, Null, Null, 0, 1);

return dominantCycle;
}

filtData = RoofingFilter(LPeriod, HPeriod);
AutocorrelationPeriodogram(filtData, IsPlotHeatMap, IsPlotDominantCycle);
3
Amibroker Help / Re: amiquote
« Last post by administrator on November 06, 2017, 06:32:38 pm »
Unfortunately Yahoo shut down its service. Don't know of any alternatives at this moment.
4
Amibroker Help / amiquote
« Last post by darts44 on November 03, 2017, 05:24:19 pm »
What happened to amiquote, it is not working? Is amiquote not supported anymore by Yahoo? What is the best free alternative?
5
Trading System Discussion / Backtesting Help
« Last post by sunilnagmal on November 03, 2017, 04:12:20 am »
Hi I have a AFL strategy and signal is generated in the middle of the day say 9:15 am open 1000 and buy signal generated at 11:00 AM 1100.

While backtesting on daily buy is taken as open price of day whereas i want the buy price to be signal generated price.

Also once a buy signal is generated consecutive another buy after days is also genereated some times how i can modify code to show only 1st signal or supress another buy signal till there one open buy signal.

Any help would be much appreciated
Thanx in advance.

Regards,
Sunil Nagmal
6
Amibroker Help / Backtesting Help
« Last post by sunilnagmal on November 03, 2017, 04:11:23 am »
Hi I have a AFL strategy and signal is generated in the middle of the day say 9:15 am open 1000 and buy signal generated at 11:00 AM 1100.

While backtesting on daily buy is taken as open price of day whereas i want the buy price to be signal generated price.

Also once a buy signal is generated consecutive another buy after days is also genereated some times how i can modify code to show only 1st signal or supress another buy signal till there one open buy signal.

Any help would be much appreciated
Thanx in advance.

Regards,
Sunil Nagmal
7
Amibroker Help / Re: download Amibroker
« Last post by Perkins on October 31, 2017, 04:28:21 am »
Oh this explains why I couldn't find the download for my device. Thanks for the info.
8
Amibroker Help / Re: Cannot chage time period from daily
« Last post by wasteof on October 30, 2017, 12:33:08 pm »
Hi Steve,

             Many thanks for the tip.

             John G
9
Amibroker Help / Re: Cannot chage time period from daily
« Last post by Steve on October 30, 2017, 09:45:48 am »
I could not change from the Weekly View. I replaced the data folder with a previous backup. This fixed the problem and I can now change to any of the views.
10
Amibroker Help / Cannot chage time period from daily
« Last post by wasteof on October 28, 2017, 11:29:33 am »
Hi,

         I wonder if anyone has suffered from this problem & found a fix.  The data loaded is daily & I am unable to alter to weekly, etc. in either the box @ top of screen, View or the toolbar on the right.

         The d'base settings are:  local data storage enabled;   No. of bars 250;  Base time interval  EOD.

         Hopeful thanks,

         John

Pages: [1] 2 3 ... 10