Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
How to reference a chart's indicators when coding in MultiCharts?
Novice question: I have added studies to a chart and would like to build a strategy (signal) to trade based on them. For example, I have "Mov Avg 1 Line" on my chart. I would like to place a BUY STP order 1 cent above that signal's value (assuming price is currently lower than that value), and update the BUY STP price whenever that indicator's value changes (at the close of each bar, when the MA gets recalculated).
I'm sure there will be a few challenges but the first one is how to reference the price of that indicator, which has already been added to the chart? Or do I need to reproduce that indicator within the code?
I will need to code the following logic:
If Close is lower than "Mov Avg 1 Line" value, place BUY STP at "Mov Avg 1 Line" value + 1 tick
I can tell my next problem will be how to place a BUY STP at a certain price, in advance, and then update that order at the close of each bar, since it seems most example strategies use "buy next bar at market" which is not what I want. Thanks guys!
Can you help answer these questions from other members on NexusFi?
you will have to reproduce the code within the signal and can't reference the indicators on the chart directly.
When you open the code for the "Mov Avg 1 Line" the top lines are the ones necessary for calculating the average.
Change var0 will something more meaningful like vAverage, so you can find your way around your code better.
The code below is a demonstration on how you could code what you have in mind and is not meant for live trading:
That's incredibly helpful, thank you. I was just using a Powerlanguage tutorial on your website yesterday so it's very cool to be talking to you on here. This gives me a lot to work with for now.