Re: Fun with ThinkScript October 08, 2015 03:43PM |
Registered: 9 years ago Posts: 60 |
#Bgin code AssignPriceColor( if BarNumber() >=1 and BarNumber() <= 5 then Color.yellow else if BarNumber() >=6 and BarNumber() <=10 then Color.white else if BarNumber() >=11 and BarNumber() <=15 then Color.blue else if BarNumber() >=16 and BarNumber() <=20 then Color.red else Color.current); #End code
#Begin Code #BarCount input start = 0730; input end = 1400; input paintbars = yes; def stV = if SecondsTillTime(start) > 0 then 1 else 0; def stVstart = if stV then BarNumber() else stVstart[1]; plot BarCount = BarNumber() - stVstart; BarCount.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW); AssignPriceColor( if !paintbars then Color.CURRENT else if BarCount > 0 and BarCount < 6 then Color.YELLOW else if BarCount > 5 and BarCount < 11 then Color.WHITE else if BarCount > 10 and BarCount < 16 then Color.BLUE else if BarCount > 15 and BarCount < 21 then Color.RED else Color.CURRENT); #End Code
Re: thinkorswim custom scan study with variable October 08, 2015 06:13PM |
Registered: 8 years ago Posts: 5 |
Re: Fun with ThinkScript October 08, 2015 06:43PM |
Registered: 8 years ago Posts: 5 |
Re: Fun with ThinkScript October 08, 2015 08:57PM |
Registered: 8 years ago Posts: 161 |
Re: Fun with ThinkScript October 08, 2015 09:09PM |
Registered: 8 years ago Posts: 161 |
Re: Fun with ThinkScript October 09, 2015 08:25AM |
Registered: 8 years ago Posts: 5 |
Re: Fun with ThinkScript October 09, 2015 09:55AM |
Registered: 8 years ago Posts: 5 |
Re: Fun with ThinkScript October 10, 2015 12:21PM |
Registered: 8 years ago Posts: 1 |
Re: Fun with ThinkScript October 10, 2015 07:12PM |
Registered: 9 years ago Posts: 9 |
The Price Divergence Indicator October 13, 2015 02:35PM |
Registered: 9 years ago Posts: 5 |
Re: The Price Divergence Indicator October 14, 2015 03:25AM |
Registered: 8 years ago Posts: 161 |
declare lower; input price = close; input evalperiod1 = 3; input evalperiod2 = 3; input evalperiod3 = 5; def slope1 = price-price[evalperiod1]; def slope2 = average(slope1,evalperiod2); def slope3 = average(slope1,evalperiod3); def slope4 = (slope2/slope3)*100; plot slope5 = slope4; slope5.AssignValueColor(if slope5>= 0 then color.Blue else color.Red); def myDPO = reference DetrendedPriceOsc; def slope6 = myDPO-myDPO[evalperiod1]; def slope7 = average(slope6,evalperiod2); def slope8 = average(slope6,evalperiod3); def slope9 = (slope6/slope7)*100; plot slope10 = slope9; slope10.AssignValueColor(if slope10>= 0 then color.Blue else color.Red);
Re: Fun with ThinkScript October 14, 2015 11:24PM |
Registered: 9 years ago Posts: 5 |
Who can code a pinbar detection study for TOS? October 16, 2015 03:36PM |
Registered: 9 years ago Posts: 60 |
Quote
//+------------------------------------------------------------------+
//| Pinbar Detector |
//| Copyright © 2011, EarnForex.com |
//| [url]http://www.earnforex.com/[/url] |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, EarnForex"
#property link "[url]http://www.earnforex.com[/url]"
/*
Pinbar Detector - detects Pinbars on charts.
Has two sets of predefined settings: common and strict.
Fully modifiable parameters of Pinbar pattern.
Usage instructions:
[url]http://www.earnforex.com/forex-strategy[/url] ... ing-system
*/
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_width1 2
#property indicator_color2 Lime
#property indicator_width2 2
extern bool UseAlerts = true;
extern bool UseEmailAlerts = false; // Don't forget to configure SMTP parameters in Tools->Options->Emails
extern bool UseCustomSettings = false; // true = use below parameters
extern double CustomMaxNoseBodySize = 0.33; // Max. Body / Candle length ratio of the Nose Bar
extern double CustomNoseBodyPosition = 0.4; // Body position in Nose Bar (e.g. top/bottom 40%)
extern bool CustomLeftEyeOppositeDirection = true; // true = Direction of Left Eye Bar should be opposite to pattern (bearish bar for bullish Pinbar pattern and vice versa)
extern bool CustomNoseSameDirection = false; // true = Direction of Nose Bar should be the same as of pattern (bullish bar for bullish Pinbar pattern and vice versa)
extern bool CustomNoseBodyInsideLeftEyeBody = false; // true = Nose Body should be contained inside Left Eye Body
extern double CustomLeftEyeMinBodySize = 0.1; // Min. Body / Candle length ratio of the Left Eye Bar
extern double CustomNoseProtruding = 0.5; // Minmum protrusion of Nose Bar compared to Nose Bar length
extern double CustomNoseBodyToLeftEyeBody = 1; // Maximum relative size of the Nose Bar Body to Left Eye Bar Body
extern double CustomNoseLengthToLeftEyeLength = 0; // Minimum relative size of the Nose Bar Length to Left Eye Bar Length
extern double CustomLeftEyeDepth = 0.1; // Minimum relative depth of the Left Eye to its length; depth is difference with Nose's back
// Indicator buffers
double Down[];
double Up[];
// Global variables
int LastBars = 0;
double MaxNoseBodySize = 0.33;
double NoseBodyPosition = 0.4;
bool LeftEyeOppositeDirection = true;
bool NoseSameDirection = false;
bool NoseBodyInsideLeftEyeBody = false;
double LeftEyeMinBodySize = 0.1;
double NoseProtruding = 0.5;
double NoseBodyToLeftEyeBody = 1;
double NoseLengthToLeftEyeLength = 0;
double LeftEyeDepth = 0.2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator buffers mapping
SetIndexBuffer(0, Down);
SetIndexBuffer(1, Up);
//---- drawing settings
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0, 74);
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1, 74);
//----
SetIndexEmptyValue(0, EMPTY_VALUE);
SetIndexEmptyValue(1, EMPTY_VALUE);
//---- indicator labels
SetIndexLabel(0, "Bearish Pinbar"
SetIndexLabel(1, "Bullish Pinbar"
//----
if (UseCustomSettings)
{
MaxNoseBodySize = CustomMaxNoseBodySize;
NoseBodyPosition = CustomNoseBodyPosition;
LeftEyeOppositeDirection = CustomLeftEyeOppositeDirection;
NoseSameDirection = CustomNoseSameDirection;
LeftEyeMinBodySize = CustomLeftEyeMinBodySize;
NoseProtruding = CustomNoseProtruding;
NoseBodyToLeftEyeBody = CustomNoseBodyToLeftEyeBody;
NoseLengthToLeftEyeLength = CustomNoseLengthToLeftEyeLength;
LeftEyeDepth = CustomLeftEyeDepth;
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int NeedBarsCounted;
double NoseLength, NoseBody, LeftEyeBody, LeftEyeLength;
if (LastBars == Bars) return(0);
NeedBarsCounted = Bars - LastBars;
LastBars = Bars;
if (NeedBarsCounted == Bars) NeedBarsCounted--;
for (int i = NeedBarsCounted; i >= 1; i--)
{
// Won't have Left Eye for the left-most bar
if (i == Bars - 1) continue;
// Left Eye and Nose bars's paramaters
NoseLength = High[i] - Low[i];
if (NoseLength == 0) NoseLength = Point;
LeftEyeLength = High[i + 1] - Low[i + 1];
if (LeftEyeLength == 0) LeftEyeLength = Point;
NoseBody = MathAbs(Open[i] - Close[i]);
if (NoseBody == 0) NoseBody = Point;
LeftEyeBody = MathAbs(Open[i + 1] - Close[i + 1]);
if (LeftEyeBody == 0) LeftEyeBody = Point;
// Bearish Pinbar
if (High[i] - High[i + 1] >= NoseLength * NoseProtruding) // Nose protrusion
{
if (NoseBody / NoseLength <= MaxNoseBodySize) // Nose body to candle length ratio
{
if (1 - (High[i] - MathMax(Open[i], Close[i])) / NoseLength < NoseBodyPosition) // Nose body position in bottom part of the bar
{
if ((!LeftEyeOppositeDirection) || (Close[i + 1] > Open[i + 1])) // Left Eye bullish if required
{
if ((!NoseSameDirection) || (Close[i] < Open[i])) // Nose bearish if required
{
if (LeftEyeBody / LeftEyeLength >= LeftEyeMinBodySize) // Left eye body to candle length ratio
{
if ((MathMax(Open[i], Close[i]) <= High[i + 1]) && (MathMin(Open[i], Close[i]) >= Low[i + 1])) // Nose body inside Left Eye bar
{
if (NoseBody / LeftEyeBody <= NoseBodyToLeftEyeBody) // Nose body to Left Eye body ratio
{
Re: Who can code a pinbar detection study for TOS? October 16, 2015 04:35PM |
Registered: 9 years ago Posts: 60 |
Quote
# from our russian friends
# How to trade:
# [url]https://www.dukascopy.com/fxcomm/fx-article-contest/?Price-Action-Pin-Bar-Strategy=&action=read&id=2195&language=en[/url]
# by [email]jaimepinto@rogers.com[/email]
# Oct/16/2015
input iRatio = 2.5;
input iBars = 2;
def iTelo=absValue (close-open);
def bPinUp = (((high - low)/(iTelo )) >iRatio) and high > high[1] and low>low[1] and max(open,close)<high-((high-low)/2);
def bPinDown =(((high - low)/(iTelo )) >iRatio) and high < high[1] and low<low[1] and min(open,close)>low+((high-low)/2);
def bTrendUp = fold TUbar = 1 to iBars+1 with TUsumm=1 do if (close[TUbar]-open[TUbar]>0) then TUsumm*1 else TUsumm*0;
def bTrendUp2 = fold TUbar2 = 1 to iBars with TUsumm2=1 do if (high[TUbar2]==highest(high[TUbar2],iBars)) then TUsumm2*1 else TUsumm2*0;
def bTrendDown = fold TDbar = 1 to iBars+1 with TDsumm=1 do if (open[TDbar]-close[TDbar]>0) then TDsumm*1 else TDsumm*0;
def bTrendDown2 = fold TDbar2 = 1 to iBars with TDsumm2=1 do if (low[TDbar2]==lowest(low[TDbar2],iBars)) then TDsumm2*1 else TDsumm2*0;
def bSignalUp = bPinUp and bTrendUp and bTrendUp2;
def bSignalDown = bPinDown and bTrendDown and bTrendDown2;
plot up = if bSignalUp then high else double.NaN;
plot down = if bSignalDown then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down);
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
up.setDefaultColor(color.MAGENTA);
down.setDefaultColor(color.CYAN);
Re: Fun with ThinkScript October 18, 2015 09:08PM |
Registered: 8 years ago Posts: 1 |
Re: Fun with ThinkScript October 19, 2015 10:57AM |
Registered: 10 years ago Posts: 27 |
Re: Fun with ThinkScript October 20, 2015 01:47AM |
Registered: 8 years ago Posts: 1 |
Re: Fun with ThinkScript October 22, 2015 12:08PM |
Registered: 8 years ago Posts: 2 |
Watchlist Column tracking Hi/Lo TOS Chart Bubbles October 23, 2015 06:09PM |
Registered: 8 years ago Posts: 1 |
Re: Watchlist Column tracking Hi/Lo TOS Chart Bubbles October 25, 2015 11:29AM |
Registered: 9 years ago Posts: 78 |
Re: Fun with ThinkScript October 25, 2015 01:29PM |
Registered: 8 years ago Posts: 2 |
NEED HELP WITH A ToS SCANNER! October 28, 2015 01:35AM |
Registered: 8 years ago Posts: 3 |
info question? October 29, 2015 09:04PM |
Registered: 8 years ago Posts: 15 |
Help with thinkscript aggregation November 10, 2015 10:15AM |
Registered: 8 years ago Posts: 1 |
Re: Fun with ThinkScript November 10, 2015 07:59PM |
Registered: 9 years ago Posts: 53 |
Re: Fun with ThinkScript November 14, 2015 12:16AM |
Registered: 8 years ago Posts: 9 |
Using levels from EOD charts in intraday charts November 15, 2015 06:21PM |
Registered: 9 years ago Posts: 13 |
Re: Using levels from EOD charts in intraday charts November 18, 2015 02:54PM |
Registered: 10 years ago Posts: 464 |
Re: Using levels from EOD charts in intraday charts November 18, 2015 03:10PM |
Registered: 8 years ago Posts: 161 |
Re: Using levels from EOD charts in intraday charts November 18, 2015 04:00PM |
Registered: 10 years ago Posts: 464 |