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
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
-
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 johnMoss, 03-04-2024, 01:53 PM
|
3 responses
46 views
0 likes
|
Last Post
by AndyM
Today, 06:13 PM
|
||
Started by algospoke, Today, 06:01 PM
|
0 responses
8 views
0 likes
|
Last Post
by algospoke
Today, 06:01 PM
|
||
Started by cre8able, Today, 05:53 PM
|
0 responses
8 views
0 likes
|
Last Post
by cre8able
Today, 05:53 PM
|
||
Started by Wessel, 03-23-2024, 02:37 PM
|
3 responses
24 views
0 likes
|
Last Post Today, 04:58 PM | ||
Started by martini, Yesterday, 04:45 PM
|
4 responses
32 views
0 likes
|
Last Post
by martini
Today, 04:48 PM
|
Comment