Simple Coding Help - No Promise.

TraderRavi

low risk profile
looks like both the versions using same AFL 3.40, but interpreting differently

@TraderRavi use

StrToDateTime(startDateTime) in place of startDateTime
StrToDateTime(endDateTime) in place of endDateTime

for first two errors

and

AddTextColumn in place of in AddColumn

on last two errors

.

it is throwing lot of errors, will post screenshot in night.
 
Code:
//Input two dates, give difference in price between first and last date
//Daily charts
//Change filter to suit

startDateTime = ParamDate("Start Date", "2019-01-01", 2);
endDateTime = ParamDate("End Date", "2019-06-30", 2);

valueStart = Lookup(Open, StrToDateTime(startDateTime), 1); // return exact or successor
valueEnd = Lookup(Close, StrToDateTime(endDateTime), -1); //return exact or previous
valueDiffPercent = 100 * (valueEnd - valueStart) / valueStart;

Filter = valueEnd > 20 AND valueEnd * Volume > 500000;

AddTextColumn(startDateTime, "Start Date");
AddTextColumn(endDateTime, "End Date");
AddColumn(valueStart, "Start Value", 1.2);
AddColumn(valueEnd, "End Value", 1.2);
AddColumn(valueDiffPercent, "% diff", 1.0, colorDefault, IIf(valueDiffPercent >= 0, colorAqua, colorPink));
Don't have your version (5.5) to verify,
but the above code is the one with the 4 changes that i thought
should make it work.


.
 

TraderRavi

low risk profile
Code:
//Input two dates, give difference in price between first and last date
//Daily charts
//Change filter to suit

startDateTime = ParamDate("Start Date", "2019-01-01", 2);
endDateTime = ParamDate("End Date", "2019-06-30", 2);

valueStart = Lookup(Open, StrToDateTime(startDateTime), 1); // return exact or successor
valueEnd = Lookup(Close, StrToDateTime(endDateTime), -1); //return exact or previous
valueDiffPercent = 100 * (valueEnd - valueStart) / valueStart;

Filter = valueEnd > 20 AND valueEnd * Volume > 500000;

AddTextColumn(startDateTime, "Start Date");
AddTextColumn(endDateTime, "End Date");
AddColumn(valueStart, "Start Value", 1.2);
AddColumn(valueEnd, "End Value", 1.2);
AddColumn(valueDiffPercent, "% diff", 1.0, colorDefault, IIf(valueDiffPercent >= 0, colorAqua, colorPink));
Don't have your version (5.5) to verify,
but the above code is the one with the 4 changes that i thought
should make it work.


.

Happy sir, It is giving results now while exploring. But Many results of each scrip coming instead of one result .
edit : problem solved as below post.

ScreenHunter_905 Oct. 05 08.05.jpg
 
Last edited:

TraderRavi

low risk profile
I have changed Range to "1 recent day" , instead of "from - to dates" ; now it is working .
"1 recent bar" is also same ?

Untitled.png


ScreenHunter_905 Oct. 05 08.13.jpg
 
Last edited:

chintan786

Well-Known Member
Dear Yusi, Happy Ji,

requesting AFL having given condition:

Need AFL to high light Bar with Blue Arrow having given condition :

1. Lowest Volume compare to last N- bars -- Blue Dot

2 Highest volume compare to last n-bars --- red Dot

Regards,
 

yusi

Well-Known Member
C-like:
_SECTION_BEGIN("DotsForHighestLowestVolume");
/*
https://www.traderji.com/community/threads/simple-coding-help-no-promise.90119/post-1386140

Need AFL to high light Bar with Blue Arrow (??!!) having given condition :
1. Lowest Volume compare to last N- bars -- Blue Dot
2 Highest volume compare to last n-bars --- red Dot
*/

Nbars = Param("N-bars", 14, 100, 1);

LowestVolume = LLV(Volume, Nbars) == Volume;
HighestVolume = HHV(Volume, Nbars) == Volume;

//PlotShapes((LowestVolume OR HighestVolume) * (shapeCircle + shapePositionAbove), IIf(LowestVolume, colorBlue, colorRest), 0, High);
PlotShapes(LowestVolume * (shapeCircle + shapePositionAbove), colorBlue, 0, High);
PlotShapes(HighestVolume * (shapeCircle + shapePositionAbove), colorRed, 0, High);

_SECTION_END();

//Add above section to any price plot. Lines below are for completeness / stand-alone checks.
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} {{OHLCX}} Vol %.0f {{VALUES}}", V ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
 

chintan786

Well-Known Member
C-like:
_SECTION_BEGIN("DotsForHighestLowestVolume");
/*
https://www.traderji.com/community/threads/simple-coding-help-no-promise.90119/post-1386140

Need AFL to high light Bar with Blue Arrow (??!!) having given condition :
1. Lowest Volume compare to last N- bars -- Blue Dot
2 Highest volume compare to last n-bars --- red Dot
*/

Nbars = Param("N-bars", 14, 100, 1);

LowestVolume = LLV(Volume, Nbars) == Volume;
HighestVolume = HHV(Volume, Nbars) == Volume;

//PlotShapes((LowestVolume OR HighestVolume) * (shapeCircle + shapePositionAbove), IIf(LowestVolume, colorBlue, colorRest), 0, High);
PlotShapes(LowestVolume * (shapeCircle + shapePositionAbove), colorBlue, 0, High);
PlotShapes(HighestVolume * (shapeCircle + shapePositionAbove), colorRed, 0, High);

_SECTION_END();

//Add above section to any price plot. Lines below are for completeness / stand-alone checks.
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} {{OHLCX}} Vol %.0f {{VALUES}}", V ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Many thanks
 

Similar threads