Simple Coding Help - No Promise.

pratapvb

Well-Known Member
Google. The feed is good, its the candle timing. My candles are formed at 10:15, 11:15 and so on but your's are at 11 and 12 and so on..... I do not know how to change this.
can change start time in ami file->database settings->intraday settings to 9.01 or 9.00 (depending on data provider) to get bar completion at 10 11 etc

9.16 or 9.15 for 10.15 11.15 etc

I keep at 8.31 so my 1st hourly bar completes 9.30 and get 10.30 11.30 etc
 

pratapvb

Well-Known Member
Would it make a difference to trading signals or better accuracy?

Like you explained I have database timing set to 9:15 which is probably why I am getting such candles. Technically market opens at 9:15 and so 30min candle should complete at 9:44:59?
I prefer to finish of the volatility due to overnight cues in the 1st bar so I keep 8.31 so that 1st 15min 30min and hourly all complete at 9.30...

if you have tested with a particular setting pls trade it...you can always 1st test offline with the new settings before switching if you find it better
 

Nehal_s143

Well-Known Member
Would it make a difference to trading signals or better accuracy?

Like you explained I have database timing set to 9:15 which is probably why I am getting such candles. Technically market opens at 9:15 and so 30min candle should complete at 9:44:59?
if using start ime as 8.31 or 8.30, your last candle on hourly chart is completed at end of day i.e close of market at 3.30 pm, if you keep 9 or 9.15 as start time then on hourly chart last candle close at 4 pm where as market has already closed at 3.30pm, even Viratech is following same method of opening candle as 8.30 am
 
What are your sell/cover conditions exactly? Only 1% of capital as target and SL? If yes,

Code:
risk = Param("Risk", 1, 0.1, 100, 0.1);
risk1 = risk/100;

BuyPrice = ValueWhen(Buy, Close);
Sell = Cross(BuyPrice * (1-risk1/100), Close) OR Cross(Close, BuyPrice * (1+risk1/100));

ShortPrice = ValueWhen(Short, Close);
Cover = Cross(ShortPrice * (1-risk1/100), Close) OR Cross(Close, ShortPrice * (1+risk1/100));
No syntax error but could not test if the code is working fine.
When back tested observed the follg:

1. It decides the position size and sl/tgt w.r.t buyprice/sellprice to initial equity and % of risk i.e. if the IE is 50000, and buyprice of a scrip is 250, risk is 1%, the position size is 50000/250 is 200 shares and tgt is 252.5 and sl is 247.5.

But in my case SL is prv bar low/high for buy and sell. I decide the position size based on prv bar range and 1% risk.

If initial equity is 50k, and prv bar( bfor buy trigger) range is 5rs. I buy/sell 100 shares.(1% risk is 500 and 500/5) My profit /loss is buyprice plus prv bar range and viceversa for sell.

So it makes a huge diff. How to solve this difference?

Thank you for your effort.
 

Nehal_s143

Well-Known Member
It actually doesn't makes a difference to me whether candle starts at 9:15 or 9 or 8:30. If we start at 8:30 first hourly and 30min candles will be half and if start at 9:15 last 30min and hourly candle will be half, which I don't think will make a difference.

What matters is this would improve accuracy and draw drowns of my system or not. I'll be testing my system through out again as its weekend and then decide what candle timing I use.
If you are trading on 5 min or 10 min or 15 min TF, this will not make any effect on your signals, but if your are using 30 min or 60 min TF for signal, sure your signals will change
 

Nehal_s143

Well-Known Member
I am trying to use afl on 5 min chart for 10 min TF using expand command but value on 5min are not coming correct

please help

Code:
_SECTION_BEGIN("Earth");
VAR2=(High+Low+(Close)*(2))/(4);
B = ((EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))*(38));
bot1 = ((((-1))*(EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))+0.01)*(38));
VAR22=((Close-LLV(Low,10))/(HHV(High,10)-LLV(Low,10)))*(100);
VAR33=EMA(VAR22,10);
VAR44=EMA(VAR33,10);
VAR55=(3)*(VAR33)-(2)*(VAR44);
VAR66=EMA(VAR55,5);
BridgeT = (EMA(VAR66,1));

//myc=IIf(bridget > Ref(bridget,-1),colorBlue,colorRed);
//Plot(6, "ribbon", myc, styleOwnScale| styleArea|styleNoLabel,-0.5,100);

_SECTION_END();


_SECTION_BEGIN("Earth 10min");
tf=10;
tfrm=in1Minute*tf;
TimeFrameSet(tfrm);

VAR2=(High+Low+(Close)*(2))/(4);
B = ((EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))*(38));
bot1 = ((((-1))*(EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))+0.01)*(38));
VAR22=((Close-LLV(Low,10))/(HHV(High,10)-LLV(Low,10)))*(100);
VAR33=EMA(VAR22,10);
VAR44=EMA(VAR33,10);
VAR55=(3)*(VAR33)-(2)*(VAR44);
VAR66=EMA(VAR55,5);
BridgeT = (EMA(VAR66,1));

TimeFrameRestore();

BridgeT2f = TimeFrameExpand( BridgeT, tfrm);

myc2=IIf(bridget2f > Ref(bridget2f,-1),colorBlue,colorRed);
Plot(6, "ribbon", myc2, styleOwnScale| styleArea|styleNoLabel,-0.5,100);

_SECTION_END();
 
Last edited:

Nehal_s143

Well-Known Member
Thank you sir, overlapping is not main problem, please see snap shot for details

on 5 min chart 10 min ribbon between 13.00 hrs to 14.30 hrs approx shows red and blue too offen, marked with yellow box on both charts where as actually on 10 min same time frame mostly blue

5 min chart


how to use print screen

10 min chart


how to print screen on pc

Your ribbons are overlapping.

Code:
_SECTION_BEGIN("Earth");
VAR2=(High+Low+(Close)*(2))/(4);
B = ((EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))*(38));
bot1 = ((((-1))*(EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))+0.01)*(38));
VAR22=((Close-LLV(Low,10))/(HHV(High,10)-LLV(Low,10)))*(100);
VAR33=EMA(VAR22,10);
VAR44=EMA(VAR33,10);
VAR55=(3)*(VAR33)-(2)*(VAR44);
VAR66=EMA(VAR55,5);
BridgeT = (EMA(VAR66,1));

myc=IIf(bridget > Ref(bridget,-1),colorBlue,colorRed);
Plot(12, "ribbon", myc, styleOwnScale| styleArea|styleNoLabel,-10,150);
_SECTION_END();


_SECTION_BEGIN("Earth 10min");
tf=10;
tfrm=in1Minute*tf;
TimeFrameSet(tfrm);

VAR2=(High+Low+(Close)*(2))/(4);
B = ((EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))*(38));
bot1 = ((((-1))*(EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))+0.01)*(38));
VAR22=((Close-LLV(Low,10))/(HHV(High,10)-LLV(Low,10)))*(100);
VAR33=EMA(VAR22,10);
VAR44=EMA(VAR33,10);
VAR55=(3)*(VAR33)-(2)*(VAR44);
VAR66=EMA(VAR55,5);
BridgeT = (EMA(VAR66,1));

TimeFrameRestore();

BridgeT2f = TimeFrameExpand( BridgeT, tfrm);

myc2=IIf(bridget2f > Ref(bridget2f,-1),colorBlue,colorRed);
Plot(6, "ribbon", myc2, styleOwnScale| styleArea|styleNoLabel, 0.1,100);
_SECTION_END();
 
Hi,

I need AFL exploration for the below indicator with the result showing the value of %K ( Lead indicator ) of all stocks for a given Time Frame. I am not an engineer or computer related profession, Hence your help in this regard will be great and thanks in advance.


_SECTION_BEGIN("Stochastic Slow5");
//periods = Param( "Periods", 5, 5, 200, 1 );
//Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Plot( StochK( 5 , 3), "%K(5,3)-Lead Indicator", ParamColor( "%K color", colorCycle ), ParamStyle("%K style") );
//Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
Plot( StochD( 5 , 3, 3 ), "%D(5,3,3)", ParamColor( "%D color", colorCycle ), ParamStyle("%D style") );

if( Status("action") == actionCommentary )
{
printf("(Interpretation is not available yet)");
}
Plot(80, "",colorBlack);
Plot(20, "",colorBlack);

_SECTION_END();
 

raynor

Active Member
A Help is Required..... Can the position of New candle can be shifted from left last to middle of the screen
 

Similar threads