My visual effect afl collection.

hi yasu..was just going thru this thread and must say u have been doing great service. I wanted to ask u if u could code a AFL for me. It displays in msg brd the time when stochastics % D (5,3,3) last closed below 31 on different time frames like 1,3, 5, 10 & 15 mins and colour od msg brd will remain blue till price is ABOVE 10 EMA on 15 min time frame and turn red when price goes below 10 EMA on 15 min time frame thanx in advance.
 
one contribution from my end.

value chart

PHP:
_SECTION_BEGIN("Price 29");
SetChartOptions(0,chartShowArrows|chartShowDates);
    SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border
    SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
    tchoice=Param("Title Selection ",2,1,2,1);
 
////  Vchart
//This was converted from code created for TradeStation by Mark W. Helweg of ValueCharts.com
VarNumbars = Param("Number of candlestick",5,2,1000,1);
Color = Param("Bar Color",colorBlue);
Top = Param("Top Chart Line",8);
TopMid = Param("Top Mid Chart Line",4);
BottomMid = Param("Bottom Mid Chart Line",-4);
Bottom = Param("Bottom Chart Line",-8);
Plot(Top,"Top Chart Line",colorRed);
Plot(TopMid,"Top Mid Chart Line",colorLightGrey);
Plot(BottomMid,"Bottom Mid Chart Line",colorLightGrey);
Plot(Bottom,"Bottom Chart Line",colorRed);
 
LRange = 0;
    VarP = round(VarNumBars/5);
if (VarNumBars > 7)
{
    VarA=HHV(H,VarP)-LLV(L,VarP);
    VarR1 = IIf(VarA==0 AND VarP==1,abs(C-Ref(C,-Varp)),VarA);
    VarB=Ref(HHV(H,VarP),-VarP+1)-Ref(LLV(L,VarP),-VarP);
    VarR2 = IIf(VarB==0 AND VARP==1,abs( Ref(C,-VarP)-Ref(C,-Varp*2) ),VarB);
    VarC=Ref(HHV(H,VarP),-VarP*2)-Ref(LLV(L,VarP),-VarP*2);
    VarR3 = IIf(VarC == 0 AND VarP==1,abs(Ref(C,-Varp*2)-Ref(C,-Varp*3)),VarC); 
    VarD = Ref(HHV(H,VarP),-VarP*3)-Ref(LLV(L,VarP),-VarP*3);
    VarR4 = IIf(VarD == 0 AND VarP==1,abs(Ref(C,-Varp*3)-Ref(C,-Varp*4)),VarD);
    VarE = Ref(HHV(H,VarP),-VarP*4)-Ref(LLV(L,VarP),-VarP*4);
    VarR5 = IIf(VarE == 0 AND VarP==1,abs(Ref(C,-Varp*4)-Ref(C,-Varp*5)),VarE);
    LRange=((VarR1+VarR2+VarR3+VarR4+VarR5)/5)*.2;
};
 
 
CDelta = abs(C - Ref(C,-1));
if (VarNumBars <=7)
{
    Var0 = IIf(CDelta > (H-L) OR H==L,CDelta,(H-L));
    LRange = MA(Var0,5)*.2;
}
MidBarAverage = MA( (H+L)/2,VarNumbars);
VOpen = (Open- MidBarAverage)/LRange;
VHigh = (High-MidBarAverage)/LRange;
VLow = (Low-MidBarAverage)/LRange;
VClose = (Close-MidBarAverage)/LRange;
PlotOHLC(VOpen,VHigh,VLow,VClose,"ValueChart",color,styleCandle| styleThick ,-12,12);
Title= Name() + " " + WriteVal( DateTime(), formatDateTime )+
"\nVOpen " + VOpen + "\n"+ " VHigh "+ VHigh + "\n"+ " VLow " + Vlow  + "\n"+ " VClose " + VClose;
Filter = Volume > 50000;
AddColumn( VOpen, "VOpen");
AddColumn( VHigh, "VHigh");
AddColumn( VLow, "VLow");
AddColumn( VClose, "VClose");
_SECTION_END();
_SECTION_END();

how can trade please explain and best time fram its using intraday chart
 
I want to enter trade at 5th bar open price if 4th bar close>3rd bar close >2nd bar close>1st bar close, exit if I earn 1% gain from open price of 5th bar
Or exit if price drops below 4th bar open

buy when 1st condition is satisfied
exit if 1% gain from entered price

This is the requirement of one of my friend
 
Re: Sms from amibroker to mobile/desktop/laptop

Correct Code as follows -

_SECTION_BEGIN("PushBullet");

EnableScript("VBScript");

<%

Public Sub pushbullet(Message_Text)
Dim Message

'Your Message
Message = Message_Text

Dim objXmlHttpMain , URL

strJSONToSend = "{""type"": ""note"", ""title"": ""Alert"", ""body"":""" &Message_Text&"""}"

URL="https://api.pushbullet.com/v2/pushes"
Set objXmlHttpMain = CreateObject("Msxml2.ServerXMLHTTP")
on error resume next
objXmlHttpMain.open "POST",URL, False
objXmlHttpMain.setRequestHeader "Authorization", "Bearer xxxxxxxxxxxxxxxxxxxxxxxxx"
objXmlHttpMain.setRequestHeader "Content-Type", "application/json"


objXmlHttpMain.send strJSONToSend

set objJSONDoc = nothing
set objResult = nothing

'Store response
'msgbox(objXmlHttpMain.responseText)
'response.Write (objXmlHttpMain.responseText)
alert("Hi")
End Sub

%>

pb = GetScriptObject();



if (LastValue(ValueWhen(Ref(Buy,-1),BarIndex())==BarIndex()) AND StaticVarGet(Name()+GetChartID()+"buyAlert")==0 )
{
pb.PushBullet("Buy Alert in " +Name() + " : BuyPrice Value is " + BuyPrice + " Time " + TimeNum());
StaticVarSet(Name()+ GetChartID() + "buyAlertBar", LastValue(TimeNum()));
}

if (LastValue(TimeNum()) == StaticVarGet(Name()+GetChartID()+"buyAlertBar"))

StaticVarSet(Name()+GetChartID()+"buyAlert",1); //alert was triggered, no more alerts on this bar
else
StaticVarSet(Name()+GetChartID()+"buyAlert",0); // new bar formed, and alerts can be trigered.



if (LastValue(ValueWhen(Ref(Sell,-1),BarIndex())==BarIndex()) AND StaticVarGet(Name()+GetChartID()+"sellAlert")==0 )
{
pb.PushBullet("Sell Alert in " +Name() + " : SellPrice Value is " + SellPrice + " Time " + TimeNum());
StaticVarSet(Name()+ GetChartID() + "sellAlertBar", LastValue(TimeNum()));
}

if (LastValue(TimeNum()) == StaticVarGet(Name()+GetChartID()+"sellAlertBar"))

StaticVarSet(Name()+GetChartID()+"sellAlert",1); //alert was triggered, no more alerts on this bar
else
StaticVarSet(Name()+GetChartID()+"sellAlert",0); // new bar formed, and alerts can be trigered.

_SECTION_END();
Error comes in code see attachment
 

Attachments

KelvinHand

Well-Known Member
Kindly See the Attachments....... something i missed or some error comes kindly tell me

7)Now Drag and Drop the pushbullet.afl code to your Trading System Charts which contains Buy/Sell Variables.

Note: you have to do a drag and drop to your existing trading system and not to insert the afl code (pushbullet.afl) only
 
Last edited:

yasu222

Active Member
The Non Repainting code

PHP:
COND1 = BUY_CONDITION;
COND2 = SELL_CONDITION;

COND1[BarCount-1]=Null;
COND2[BarCount-1]=Null;

Buy = Cross( COND1, COND2 );
Sell = Cross( COND2, COND1 );

Buy[BarCount-1]=Null;
Sell[BarCount-1]=Null;

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
GraphXSpace = 5;
or at the end of the code:-

PHP:
Buy[BarCount-1]=Null;
Sell[BarCount-1]=Null;
Short[BarCount-1]=Null;
Cover[BarCount-1]=Null;
 

Similar threads