inputs: Length(12), BiasVar(.5), TicVal(.0001),
PlotTrue(true), PlotRnd(false), BuyColor(Green), SellColor(Red);
variables: EMAval(0), TestVal(0), TVal(0), PlotColor(Green);
EMAval = XAverage(Close, Length);
If CurrentBar = 1 then begin
TestVal = EMAval;
TVal = 1;
PlotColor = Green;
end;
If TVal = 1 then begin
If EMAval <= (TestVal - BiasVar) then begin
TVal = -1;
TestVal = EMAval;
PlotColor = Red;
end else begin
TestVal = maxlist(TestVal, EMAval);
end;
end else
If TVal = -1 then begin
If EMAval >= (TestVal + BiasVar) then begin
TVal = 1;
TestVal = EMAval;
PlotColor = Green;
end else begin
TestVal = minlist(TestVal, EMAval);
end;
end;
If EMAval <> 0 then begin
If PlotTrue then Plot1(EMAval, "AvgExp", PlotColor);
If PlotRnd then Plot2( (round((EMAval/TicVal),0)*TicVal), "ExpRnd", PlotColor);
end;
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
convert EasyLanguage to NinjaScript
Collapse
X
-
convert EasyLanguage to NinjaScript
I have the following simple code that I use for multicharts. it's an EMA that changes color based on how much it changes direction. I want to use it in Ninja as well but don't know how to program ninjascript yet. how hard would it be to do this?
Code:Tags: None
-
If you're not very familiar with coding in our NinjaScript yet, I would suggest checking into shared indicators already on the same topic, especially the MA Slope Box - http://www.ninjatrader.com/support/f...h=Slope&desc=1
To get started creating your own scripts, these tutorials here would be a great start -
-
There are many indicators available for NinjaTrader that are colored according to slope.
One example is the Keltner Universal Indicator. The midband can be selected from a median and 27 different moving averages. There are three colors for the slope. The colors represent a rising, falling and flat moving average. The range of "flat slopes" can be adjusted.
There is an option not to display the Keltner Channel and you will have a moving average. The channels can be colored according to midband or channel slope.
If you wish to color the moving average according to the second derivative instad of the first, you can do this by modifying the indicator, which can be found here:
Membership is required to download the indicators (you will get a couple of hundred NinjaTrader indicators for a low one-time membership fee). I have no financial links with Big Mike, who is running the forum. You can also send me a private message with your e-mail, and I will send you the (open source) indicator.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
559 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
546 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment