need afl code for maximum 1 intraday trade per day

Status
Not open for further replies.

suri112000

Well-Known Member
#2
needs afl code for only 1 trade per day that to first signal of the day (either buy or short) and want to ignore rest of all signals of that day (either buy or short)
It is very surprising. You could not find one such AFL being in Traderji for about 7 years.:confused:
 

mastermind007

Well-Known Member
#6
JESUS!!!!

So, You're back!!!

In the meantime, Here is the AFL (with parts missing that you have
to add) to allow maximum of one trade per day.

Code:
dn = DateNum();
newDay = dn != Ref( dn,-1);

//Your existing raw buy sell logic
RawBuy = ...
RawShort = ...

//////////////////////////////////////////////////
// * * * * * * * * * * * * * * * * * * * *  *  ///
//THE SOLUTION LINE TO ACHIEVE WHAT JESUS WANTS///
// * * * * * * * * * * * * * * * * * * * *  *  ///
//////////////////////////////////////////////////
[COLOR="Red"]allowTrades = Flip(newDay, RawBuy Or RawShort);[/COLOR]


//////////////////////////////////////////////////
// * * * * * * * * * * * * * * * * * * * *  *  ///
//     THE APPLIED SOLUTION LINE OF JESUS      ///
// * * * * * * * * * * * * * * * * * * * *  *  ///
//////////////////////////////////////////////////
Buy   = [COLOR="red"]allowTrades AND [/COLOR]RawBuy....
Short = [COLOR="red"]allowTrades AND [/COLOR]RawShort....
 
Last edited by a moderator:
#7
mastermind007 sir
i applied your code for only one signal per day(either buy or short)
but signals are showing
please correct following code sir to get signals

RawBuy=H>Ref(H,-1) AND L>Ref(L,-1) AND C>Ref(C,-1) AND C>=((H-L)*0.75+L) AND O<=((H-L)*0.25+L) AND (H>=(HHV(H,20)));
RawShort=C<=((H-L)*0.25+L) AND O>=((H-L)*0.75+L) AND (L<=(LLV(L,11)));

dn = DateNum();
newDay = dn != Ref( dn,-1);
allowtrades = Flip(newDay, RawBuy OR RawShort);
Buy = allowTrades AND RawBuy;
Short = allowTrades AND RawShort;

shape = Buy * shapeUpArrow + Short * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorYellow, colorRed),0, IIf( Buy, Low, High ) );
SetChartOptions(0,chartShowArrows|chartShowDates);
 

mastermind007

Well-Known Member
#10
Re: Simple Coding Help - No Promise.

This thread is closed hence posting reply meant for it here

dn = DateNum();
newDay = dn != Ref( dn,-1);

RawBuy=(newDay == 0) AND (H>Ref(H,-1) AND L>Ref(L,-1) AND C>Ref(C,-1) AND C>=((H-L)*0.75+L) AND O<=((H-L)*0.25+L) AND (H>=(HHV(H,20))));
RawShort=(newDay == 0) AND (C<=((H-L)*0.25+L) AND O>=((H-L)*0.75+L) AND (L<=(LLV(L,11))));

//allowtrades = StaticVarGet("allowtrades");
allowtrades = Flip(newDay, Ref(RawBuy OR RawShort, -1));
Buy = allowTrades AND RawBuy;
Short = allowTrades AND RawShort;
 
Status
Not open for further replies.

Similar threads