Value1 = upticks + downticks;
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Uptick & Downtick
Collapse
X
-
here is the script I'm trying to translate. This is an improved version of the Better volume beta available on NT (provided by Goldfly). The only things I need yo know are what kind of trick can I use to code up&downticks in C# and what does this "BarType" mean.
Once I have these answers I might be able to port this indicator using better volume beta Ninjascript.
I'll be happy to share it with the NT community if I succeed but I really need your help.
hope you will understand and give me a little hand.
Better Volume Indicator
Inputs: LowVol(True), ClimaxUp(True), ClimaxDown(True), Churn(True), ClimaxChurn(True), Color(Cyan), LowVolColor(Yellow), ClimaxUpColor(Red), ClimaxDownColor(White), ChurnColor(Green), ClimaxChurnColor(Magenta), AvgColor(Red);
Variables: BarColor(Cyan), Lookback(20);
BarColor = Color;
If BarType > 1 then begin
Value1 = V;
Value2 = V*Range;
If Range <> 0 then Value3 = V/Range;
Condition1 = Value1 = Lowest(Value1,Lookback);
Condition2 = Value2 = Highest(Value2,Lookback);
Condition3 = Value3 = Lowest(Value3,Lookback);
Condition4 = Value3 = Highest(Value3,Lookback);
If LowVol and Condition1 then BarColor = LowVolColor;
If ClimaxUp and Condition2 and C > O then BarColor = ClimaxUpColor;
If ClimaxDown and (Condition2 or Condition3) and C < O then BarColor = ClimaxDownColor;
If Churn and Condition4 then BarColor = ChurnColor;
If ClimaxChurn and Condition4 and ((Condition2 and C > O) or ((Condition2 or Condition3) and C < O)) then BarColor = ClimaxChurnColor;
End;
If BarType <= 1 then begin
Value1 = UpTicks+DownTicks;
Value2 = UpTicks*Range;
Value3 = (UpTicks-DownTicks)*Range;
Value4 = DownTicks*Range;
Value5 = (DownTicks-UpTicks)*Range;
If Range <> 0 then begin
Value6 = UpTicks/Range;
Value7 = (UpTicks-DownTicks)/Range;
Value8 = DownTicks/Range;
Value9 = (DownTicks-UpTicks)/Range;
Value10 = (UpTicks+DownTicks)/Range;
End;
Condition1 = Value1 = Lowest(Value1,Lookback);
Condition2 = Value2 = Highest(Value2,Lookback);
Condition3 = Value3 = Highest(Value3,Lookback);
Condition4 = Value4 = Highest(Value4,Lookback);
Condition5 = Value5 = Highest(Value5,Lookback);
Condition6 = Value6 = Lowest(Value6,Lookback);
Condition7 = Value7 = Lowest(Value7,Lookback);
Condition8 = Value8 = Lowest(Value8,Lookback);
Condition9 = Value9 = Lowest(Value9,Lookback);
Condition10 = Value10 = Highest(Value10,Lookback);
If LowVol and Condition1 then BarColor = LowVolColor;
If ClimaxUp and (Condition2 or Condition3 or Condition8 or Condition9) and C > O then BarColor = ClimaxUpColor;
If ClimaxDown and (Condition4 or Condition5 or Condition6 or Condition7) and C < O then BarColor = ClimaxDownColor;
If Churn and Condition10 then BarColor = ChurnColor;
If ClimaxChurn and Condition10 and (((Condition2 or Condition3 or Condition8 or Condition9) and C > O) or ((Condition4 or Condition5 or Condition6 or Condition7) and C < O)) then BarColor = ClimaxChurnColor;
End;
Plot1(Value1,"Volume",BarColor);
Plot2(Average(Value1,100),"Avg",AvgColor);
Comment
-
I don't know what BarType is. Maybe its same thing as the link I provided for determine what the bar interval is. For up/down ticks, you could only calculate this in real-time. Compare the current price to the last price to see if its up or down etc... and start counting etc...RayNinjaTrader Customer Service
Comment
-
Here is what I found on TS FAQ. Maybe this will help you to tell me what is the equivalent on NT :
The effectiveness of an EasyLanguage document can depend on the data compression being used by the chart to which it is applied. BarType and BarInterval are EasyLanguage functions available for this very purpose.
The following restricts processing of the EasyLanguage document to a daily chart.ExampleThe following restricts processing of the EasyLanguage document to a 5-minute chart.
If BarType = 2 then begin
Plot1(Close,"Close");
End;
If BarType = 1 and BarInterval = 5 then begin
Plot1(Close,"Close");
End;
Comment
-
Originally posted by kuroro13 View Postok thanks. So if I really understood the thing,
Bartype<=1 is equivalent to Bars.Period.Id == PeriodType.Tick or .Second or .Minute
Bartype>1 is equivalent to Bars.Period.Id == PeriodType.Day or .Week or any higher time frame
Am I right ?
Comment
-
Bar Type
This also may help - from Easy Language..
BAR Type
The compression setting of the price data for the applied analysis technique.
Returns: 0 forTick, 1 for Intraday, 2 for Daily, 3 for Weekly, 4 for Monthly, 5 for Point & Figure.
Usage: If BarType = 2 Then {Any Operation} {tests for daily bars}
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by jaybedreamin, Today, 05:56 PM
|
0 responses
7 views
0 likes
|
Last Post
by jaybedreamin
Today, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
18 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
4 views
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
12 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
||
Started by timmbbo, Today, 08:59 AM
|
2 responses
13 views
0 likes
|
Last Post
by bltdavid
Today, 04:10 PM
|
Comment