Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
NinjaTrader DDE Connection
Collapse
X
-
nice one.. one question tho, (it's prob possible but I jus can't get an ideal result) how do you pass many different indicators value into NinjaServer.ItemValue? For example for every level1 price change, i want to pass SMA(5), SMA(20), SMA(....1000) as well as values from custom indicators to the DDE server.
the NinjaServer.ItemValue seems to be 'flooded' with these values. the gives conflicting values on the Excel client.. thanks
Comment
-
Thanks for the fast response! I'm on XP btw
i know something's wrong with my concept of the DDE server construct. Dun exactly know where. I'll use my understanding of your codes as reference.
I believe that NinjaServer.ItemValue = e.Price in the OnMarketData(MarketDataEventArgs e) block initializes the value of the server.
The part I'm not too sure is how/when I should invoke server.Advise(topic,"Command"); For your code, the condition is if (e.MarketDataType == MarketDataType.Last).
However I can't use MarketDataType if I I want an item with value SMA(3)[0], right?
I need something like
//if SMA(3) value is different from SMA(3) previous value
if (SMA(3)[0] != SMA(3)[1] && server != null)
{
NinjaServer.ItemValue = SMA(3)[0];
server.Advise(topic,"SMA3");
}
else
if (SMA(30)[0] != SMA(30)[1] && server != null)
{
NinjaServer.ItemValue = SMA(30)[0];
server.Advise(topic,"SMA30");
}
.
.
.
.
I know my concept is flawed somewhere.. because the only the first if condition has output on the client Excel, the subsequent if conditions are never captured and Excel outputs #NA
How would you pump values from indicators (not just variables of MarketDataEventArgs) to the server? or is this even possible?
Thanks
Comment
-
just remove the else from the code. it is due to that you are not getting the values for SMA30. otherwise it should work fine. in excel make sure item value is 'SMA3' and 'SMA30'Originally posted by mechcow View Post//if SMA(3) value is different from SMA(3) previous value
if (SMA(3)[0] != SMA(3)[1] && server != null)
{
NinjaServer.ItemValue = SMA(3)[0];
server.Advise(topic,"SMA3");
}
else
if (SMA(30)[0] != SMA(30)[1] && server != null)
{
NinjaServer.ItemValue = SMA(30)[0];
server.Advise(topic,"SMA30");
}
Comment
-
hmm, now, without the else there's another problem. The DDE values on the client picks up values of other items as well. So a value generated by =NJDDE|EURUSD!'SMA3' on Excel actual oscillates between the values generated by both server.Advise(topic,"SMA3") and server.Advise(topic,"SMA30"). I can see the numbers just oscillating back and forth.
Doesnt matter the logic is in OnMarketData() or OnBarUpdate()
Ever encountered something like that? Timer needed to introduce some delay?
Comment
-
-
Thanks first.
Unfortunately I'm not good in programming - I do not understand how to put this
" if (e.MarketDataType == MarketDataType.Bid)eVolumeBid = e.Volume;" - thing
into the right context, as far I understand there is no direct MarketDataType.Last/Ask/Bid Volume.
You have to substitute Volume with something like e.-variable ?
Maybe you can head me in the right direction.
Regs
Jojo
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
576 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 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
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment