Skip to content

Instantly share code, notes, and snippets.

View marketcalls's full-sized avatar

Marketcalls marketcalls

View GitHub Profile
@marketcalls
marketcalls / 1st Hour Cumulative Volume Scanner.afl
Created December 15, 2016 08:57
1st Hour Cumulative Volume Scanner
_SECTION_BEGIN("Volume For 1st Hour");
//Cumulative Volume Monitor Start Time and End Time
starttime = ParamTime( "Start Time", "09:15" );
endtime = ParamTime( "End Time", "10:15" );
Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == starttime, BarIndex());
@marketcalls
marketcalls / Compute and Plot.py
Created November 15, 2016 10:58
Compute and Plot
#Compute Percentage Change
rets = d.pct_change()
#Compute Correlation
corr = rets.corr()
#Plot Correlation Matrix using Matplotlib
%pylab inline
plt.figure(figsize=(10, 10))
plt.imshow(corr, cmap='RdYlGn', interpolation='none', aspect='auto')
@marketcalls
marketcalls / Fetch.py
Created November 15, 2016 10:52
Fetch the Stock Data from the dataframe
d= pd.DataFrame()
j=0
for i in sym:
result = get_price_history(stock=i, start=date(2016,10,1), end=date(2016,11,15))
if result.empty:
pass
else:
s2=result[['Close']]
s2=s2.rename(columns = {'Close':i})
if j==0:
@marketcalls
marketcalls / Import and Add Stocks.py
Created November 15, 2016 10:50
Import and Add Stocks
#Import Python Packages
from nsepy.archives import get_price_history
from datetime import date
import pandas as pd
import matplotlib.pyplot as plt
#Create Stocks Watchlist for which correlation martrix is to be plotted.
sym=["SBIN","BHEL","ACC","GAIL","TATAMOTORS","TCS","INFY","SUNPHARMA","IDEA","RELIANCE"]
@marketcalls
marketcalls / Sentimental RSI - Marketcalls
Created October 5, 2016 00:40
Sentimental RSI - Marketcalls - Tradingview PineScript
////////////////////////////////////////////////////////////
// Copyright by Rajandran R v1.0 22/08/2016
// Website : www.marketcalls.in
////////////////////////////////////////////////////////////
study(title="Sentimental RSI - Marketcalls")
source = hlc3, length = input(7, minval=1)
hullma = wma(2*wma(source, length/2)-wma(source, length), round(sqrt(length)))
hrsi = rsi(hullma,length)
bcolor = iff( hrsi-50 > 0,
iff( hrsi > nz(hrsi[1]), lime, blue),
SetPositionSize(1,spsShares);
Buy = ROC(C,1)< -0.5 AND DayOfWeek()==5;
BuyPrice = Close;
Sell = DayOfWeek()!=5; //Sell on Next Day
//Sell = DayOfWeek()==1; //Sell on Monday
SellPrice = Close;
@marketcalls
marketcalls / Sentimental RSI
Created August 22, 2016 15:27
Sentimental RSI
////////////////////////////////////////////////////////////
// Copyright by Rajandran R v1.0 22/08/2016
// Website : www.marketcalls.in
////////////////////////////////////////////////////////////
study(title="Sentimental RSI - Marketcalls")
source = hlc3, length = input(7, minval=1)
hullma = wma(2*wma(source, length/2)-wma(source, length), round(sqrt(length)))
hrsi = rsi(hullma,length)
bcolor = iff( hrsi-50 > 0,
iff( hrsi > nz(hrsi[1]), lime, blue),
//Coded by Rajandran R
//Website : www.marketcalls.in
_SECTION_BEGIN("Predict Cycle");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}} - Cycle analysis indicator from www.marketcalls.in", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", colorDefault, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
@marketcalls
marketcalls / SIP - Dollar Cost Averaging.afl
Created June 17, 2016 09:42
SIP - Dollar Cost Averaging
FixedDollarAmount = 5000; //SIP monthly Rs5000
MonthBegin = Month() != Ref( Month(), -1 );
FirstPurchase = Cum( MonthBegin ) == 1;
Buy = IIf( FirstPurchase, 1, // True (or 1) represents regular buy signal
IIf( MonthBegin, sigScaleIn, // each month increase position
0 ) ); // otherwise no signal
Sell = 0; // we do not sell
@marketcalls
marketcalls / Ichimoku Cloud Scanner v2.0 – AFL Code
Created June 11, 2016 10:19
Ichimoku Cloud Scanner v2.0 – AFL Code
_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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("Ichimoku Hayo Kinko");
GraphXSpace =1;
prds = Param("Standard Line Periods?", 12,5,26,1);