Simple Coding Help - No Promise.

@ bbhanushali - Sincere apologies Sir, couldn’t reply you on time due to family emergency. I’ve cross checked the code & seem buy/sell signals are generating as per respective tf. Please see below hr tf:
View attachment 33750

However I am looking out for the signals based on 5 day ema as below. Please see below the hr tf with manually marked signals:
View attachment 33752

I am using below 5ema afl code on intraday chart for buy/sell signals, adding entry signals with SL and TGTs would suffice may be.

_SECTION_BEGIN("Daily EMA");
TimeFrameSet(inDaily);
daema=EMA(C,5);
ddaema=TimeFrameExpand(daema,inDaily,expandFirst);
TimeFrameRestore();
Plot(ddaema,"5 DEMA",colorBlue,styleStaircase|styleDots);
_SECTION_END();

Requesting you to look into the issue and update it.

Thanking you!
TT
@tangotaurian: If there is no other condition but just the price cross and close up 5DEMA for Buy and price cross and close down 5DEMA for Short then the attached code if you replace in between the lines where it is said "Change below conditions to match yours" and "Change the above conditions to match yours" should work. You can try out the additional condition by removing the commented lines. Thanks.
Code:
_SECTION_BEGIN("Daily EMA");
TimeFrameSet(inDaily);
daema=EMA(C,5);
TimeFrameRestore();

ddaema=TimeFrameExpand(daema,inDaily,expandFirst);
Plot(ddaema,"5 DEMA",colorBlue,styleStaircase|styleDots);

Buy = Cross(C,ddaema) ;//AND C>O;//additional condition commented out
Short = Cross(ddaema,C);// AND C<O;//additional condition commented out


_SECTION_END();
 

kumudhan

Well-Known Member
Screenshot_1.png

RESPECTED SENIORS, NEED HELP..
1.in the chart im postingit shows yesterday hi lo close is plotted as dotted lines.i want these lelels are given in price axis too, like the today hi low levels are showing.
2.i want todays open too show like today hi and low.
3.today hih low lines are extended in yesterday chart area too.i want them to show in today chart area only...
i tried many times and unable to do this..giving the afl herewith..pl help.thanks in advance.
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();_SECTION_BEGIN("PreDay HLC");
function CDL( array )
{
doy = DayOfYear();
Lastdoy = doy == LastValue( doy );
Dayline = array * Lastdoy;
return IIf( Dayline, Dayline, Null );
}
//TIME FRAME CALCULATION
H1 = TimeFrameGetPrice( "H", inDaily, -1 ); // yesterdays high
L1 = TimeFrameGetPrice( "L", inDaily, -1 ); // low
C1 = TimeFrameGetPrice( "C", inDaily, -1 ); // close
DayO = TimeFrameGetPrice( "-1", inDaily ); // current day open
//PLOTS
Plot( cdl( H1 ), "", colorRed, styleLine + styleNoRescale + styleNoLabel+ styleDashed );
Plot( cdl( L1 ), "", colorBrightGreen, styleLine + styleNoRescale + styleNoLabel + styleDashed );
Plot( cdl( C1 ), "", colorLightGrey, styleLine + styleNoRescale + styleNoLabel + styleDashed );
Plot (LastValue(TimeFrameGetPrice("High", inDaily, 1)), "Prev H", colorGreen);
Plot (LastValue(TimeFrameGetPrice("Low", inDaily, 1)), "Prev L", colorOrange);
_SECTION_END();
 
View attachment 33779
RESPECTED SENIORS, NEED HELP..
1.in the chart im postingit shows yesterday hi lo close is plotted as dotted lines.i want these lelels are given in price axis too, like the today hi low levels are showing.
2.i want todays open too show like today hi and low.
3.today hih low lines are extended in yesterday chart area too.i want them to show in today chart area only...
i tried many times and unable to do this..giving the afl herewith..pl help.thanks in advance.
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();_SECTION_BEGIN("PreDay HLC");
function CDL( array )
{
doy = DayOfYear();
Lastdoy = doy == LastValue( doy );
Dayline = array * Lastdoy;
return IIf( Dayline, Dayline, Null );
}
//TIME FRAME CALCULATION
H1 = TimeFrameGetPrice( "H", inDaily, -1 ); // yesterdays high
L1 = TimeFrameGetPrice( "L", inDaily, -1 ); // low
C1 = TimeFrameGetPrice( "C", inDaily, -1 ); // close
DayO = TimeFrameGetPrice( "-1", inDaily ); // current day open
//PLOTS
Plot( cdl( H1 ), "", colorRed, styleLine + styleNoRescale + styleNoLabel+ styleDashed );
Plot( cdl( L1 ), "", colorBrightGreen, styleLine + styleNoRescale + styleNoLabel + styleDashed );
Plot( cdl( C1 ), "", colorLightGrey, styleLine + styleNoRescale + styleNoLabel + styleDashed );
Plot (LastValue(TimeFrameGetPrice("High", inDaily, 1)), "Prev H", colorGreen);
Plot (LastValue(TimeFrameGetPrice("Low", inDaily, 1)), "Prev L", colorOrange);
_SECTION_END();

@kumudhan: Hope this is what you are looking for. Hope it helps.

Code:
_SECTION_BEGIN("PreDay HLC and Today OHL");
function CDL( array )
{
doy = DayOfYear();
Lastdoy = doy == LastValue( doy );
Dayline = array * Lastdoy;
return IIf( Dayline, Dayline, Null );
}
//TIME FRAME CALCULATION
H1 = TimeFrameGetPrice( "H", inDaily, -1 ); // yesterdays high
L1 = TimeFrameGetPrice( "L", inDaily, -1 ); // low
C1 = TimeFrameGetPrice( "C", inDaily, -1 ); // close
DayO = TimeFrameGetPrice( "O", inDaily,0 ); // current day open
DayH = TimeFrameGetPrice("H", inDaily,0);// current day high
DayL = TimeFrameGetPrice("L", inDaily,0);// current day low
//PLOTS
Plot( cdl( H1 ), "", colorRed, styleLine + styleNoLabel+ styleDashed );
Plot( cdl( L1 ), "", colorBrightGreen, styleLine  + styleNoLabel + styleDashed );
Plot( cdl( C1 ), "", colorLightGrey, styleLine  + styleNoLabel + styleDashed );
Plot( cdl( DayH ), "", colorgreen, styleLine  + styleNoLabel + styleDashed );
Plot( cdl( DayL ), "", colorOrange, styleLine + styleNoLabel + styleDashed );
Plot( cdl( DayO ), "", colorwhite, styleLine  + styleNoLabel + styleDashed );

PlotText("PDH = "+NumToStr(H1[BarCount-1],1.2), BarCount+2, (H1[BarCount-1]), colorred) ;
PlotText("PDL = "+NumToStr(L1[BarCount-1],1.2), BarCount+2, (L1[BarCount-1]), colorbrightgreen) ;
PlotText("PDC = "+NumToStr(C1[BarCount-1],1.2), BarCount+2, (C1[BarCount-1]), colorlightGrey) ;

PlotText("DayH = "+NumToStr(DayH[BarCount-1],1.2), BarCount+2, (DayH[BarCount-1]), colorgreen) ;
PlotText("DayL = "+NumToStr(DayL[BarCount-1],1.2), BarCount+2, (DayL[BarCount-1]), colorOrange) ;
PlotText("DayO = "+NumToStr(DayO[BarCount-1],1.2), BarCount+2, (DayO[BarCount-1]), colorwhite) ;

//Plot (LastValue(TimeFrameGetPrice("High", inDaily, 1)), "Prev H", colorGreen);
//Plot (LastValue(TimeFrameGetPrice("Low", inDaily, 1)), "Prev L", colorOrange);

_SECTION_END();
 

ethan hunt

Well-Known Member
@Happy_Singh

Hi,

Looking for AFL with following conditions:

Several AFLs on web but none suits my requirement. Tried to tweak but failed.

ORB

15min

Buy at break of HIGH of first candle of the day, no entry after 2.15pm.
Target 30 points profit or if Target not met exit at 3.00pm.
SL=Low of first candle.
Entry / Exit at open of next candle.


Short at break of LOW of first candle of the day, no entry after 2.15pm.
Target 30 points profit or if Target not met exit at 3.00pm.
SL=High of first candle.
Entry / Exit at open of next candle.


Brokerage = 0.02% (can be set in back test settings)
Leverage = 4x (Futures) (can be set = 25 in back test settings)


Changeable parameters:
Chart duration - 15min to 5m, 30m, Hourly etc.
Target - can be changed from fixed to fixed (30 to say 50) and also can be changed from fixed to %.
Stoploss - can be changed from High/Low to fixed and %.
Time of exit
Margin (can be set in back test settings)
Minimum number of shares 20 (can be set in back test settings)
Maximum number of shares 1000

Should be Backtestable , Scannable , Explorable.

AFL experts kindly help.

Thanks

Bump-up !

Thanks
 

kumudhan

Well-Known Member
@kumudhan: remove the "+ styleNoLabel" from the plot part and you will get values in the axis. However, if you have tried the given afl (since you have posted your old chart) you will see that the text is also given with values e.g. PDH =Value (i.e. Previous Day High = xValue). Chose what you want.
yes ji i tried that..but in tick chart the text goes to extream right..thanj you again.
 
I don't know if this is simple or not, but!
could you help me write this efl formula, please
search for:
-find stocks that trade above $5.00
-find stocks that have average volume of 200000 shares in last 90 days
-stochastic in oversold - under 20
-bulish engulfing signal

thank you very much
 

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?