NexusFi: Find Your Edge


Home Menu

 





Trigger event in Strategy from Indicator


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one vantojo with 6 posts (0 thanks)
    2. looks_two sam028 with 3 posts (0 thanks)
    3. looks_3 rleplae with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,008 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 11 posts
    2. attach_file 1 attachments




 
Search this Thread

Trigger event in Strategy from Indicator

  #1 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Hello,

For NT 7

I want to keep a de-coupled architecture, and send an instant trade alert to a running strategy from an indicator.

I want to have one strategy listening for signals from multiple indicators or other strategies. This way I can concentrate the trade management in just one strategy.

I have a static global array working, but then the strategy needs a timer to watch for input.

Would rather just have the indicator send the signal direct to the strategy.

Any suggestions, samples?

How would the strategy "register itself" in the indicator, so the indicator could communicate?

Many thanks

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
 
  #3 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863



vantojo View Post
Hello,

For NT 7

I want to keep a de-coupled architecture, and send an instant trade alert to a running strategy from an indicator.

I want to have one strategy listening for signals from multiple indicators or other strategies. This way I can concentrate the trade management in just one strategy.

I have a static global array working, but then the strategy needs a timer to watch for input.

Would rather just have the indicator send the signal direct to the strategy.

Any suggestions, samples?

How would the strategy "register itself" in the indicator, so the indicator could communicate?

Many thanks

Why would you do the order management in a strategy and be stuck to one instrument ?

you could have a small stand alone process outside NT that is listening for the triggers,
and if you like, then create an order through the ATI interface, but keep the order mgt
completely outside of a strategy running.

the strategy is BAD anyway, you close manual an order, the strategy and all it's objects
get resetted, not a good idea for something that will hold you logic...

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Well, there would be one strategy running for each instrument. And somehow the indicator would need to match/sync to the strategy with the same Instrument.

I'm not a C# guy or a .Net guy....don't have enough skill to have something "outside" of NT setup.

Yes, I don't like the way the Strategy base is designed in NT...that NT disables the strategy when even a non-attached Chart ATM is closed.

I already do order management in an indicator with OIF. But there are lots of disadvantages to doing this, one being that the backtesting is not integrated with the strategy stats, et cetera. And, no prototypingwith the Strategy Analyzer.

Started this thread Reply With Quote
  #5 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


vantojo View Post
Well, there would be one strategy running for each instrument. And somehow the indicator would need to match/sync to the strategy with the same Instrument.

I'm not a C# guy or a .Net guy....don't have enough skill to have something "outside" of NT setup.

Yes, I don't like the way the Strategy base is designed in NT...that NT disables the strategy when even a non-attached Chart ATM is closed.

I already do order management in an indicator with OIF. But there are lots of disadvantages to doing this, one being that the backtesting is not integrated with the strategy stats, et cetera. And, no prototypingwith the Strategy Analyzer.

I guess you have your answer then...

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

You can try using named pipes with objects like NamedPipeClientStream, coding in C# is required but it's not very hard.
Your strategy can listen to this pipe(s) and act depending on what is received.
On the other side indicators or strategies can send "something" to this master strategy.


vantojo View Post
Hello,

For NT 7

I want to keep a de-coupled architecture, and send an instant trade alert to a running strategy from an indicator.

I want to have one strategy listening for signals from multiple indicators or other strategies. This way I can concentrate the trade management in just one strategy.

I have a static global array working, but then the strategy needs a timer to watch for input.

Would rather just have the indicator send the signal direct to the strategy.

Any suggestions, samples?

How would the strategy "register itself" in the indicator, so the indicator could communicate?

Many thanks


Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #7 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

I was playing with TCP before and it might work...I could assign an instrument to a single port in the loopback and then have that be the matching between indicator ??

this would allow more than one instrument, each instrument having one strategy and possibly multiple indicators talking to it over a singe port

have not looked at named pipes yet....

But, was hoping for something simplier...like

.... having the indicator trigger an event in the (decoupled) strategy

but how to match the two?

Started this thread Reply With Quote
  #8 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


vantojo View Post
I was playing with TCP before and it might work...I could assign an instrument to a single port in the loopback and then have that be the matching between indicator ??

this would allow more than one instrument, each instrument having one strategy and possibly multiple indicators talking to it over a singe port

have not looked at named pipes yet....

But, was hoping for something simplier...like

.... having the indicator trigger an event in the (decoupled) strategy

but how to match the two?

What you can do is:
- in the strategy
-> create a "service" thread
-> this service thread will read what's coming in from a namedpipe
-> if it's for a new instrument create a new thread with a new namedpipe for this specific instrument (which will be the same as the sender's namedpipe)
Then you can play with events in each threads to buy/sell or whatever you want.
I did something like to hedge two different accounts positions, it worked well, you can use the same kind of logic.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #9 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Thank you...will look at named pipes...seems not too hard...

can you post a sample of the service method code?

(just the core, not your private algos...)

:-)

Started this thread Reply With Quote
  #10 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629



vantojo View Post
Thank you...will look at named pipes...seems not too hard...

can you post a sample of the service method code?

(just the core, not your private algos...)

:-)

In fact there is more simpler than pipes with TriggerCustomEvent().
You can check this example:
- the indicator TransferToStrategy contains the entry/exit logic (very private algo: buy if bar is up, sell if bar is down )
- the TransferMaster strategy is executing orders signal sent by the indicator
- the TransferSlave strategy is executing orders signal sent by the indicator (which is the opposite of the what TransferMaster sent)

Success requires no deodorant! (Sun Tzu)
Attached Files
Elite Membership required to download: Transfer.zip
Follow me on Twitter Reply With Quote




Last Updated on October 17, 2017


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts