NexusFi: Find Your Edge


Home Menu

 





How to reference a chart's indicators when coding in MultiCharts?


Discussion in MultiCharts

Updated
    1. trending_up 3,776 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
jesse514
Montreal, QC
 
Posts: 11 since Apr 2014
Thanks Given: 5
Thanks Received: 6

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!


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
CFTC Rewrites the Rulebook -- Kalshi Cracks $1B Non-Spor …
Prediction Markets & Event Contracts
Iran Fired a Missile at Israel Last Night. The $8M June …
Prediction Markets & Event Contracts
Czechia Live at 52.5% as England Rides 4-2 Wave to Co-Fa …
Prediction Markets & Event Contracts
Netherlands & Germany Surge as World Cup Field Narro …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
16 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
2 thanks
30 Sessions
1 thanks
CME Expands 24/7 Trading to WTI Crude Oil and Gold -- We …
1 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

jesse514,

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.
 
Code
inputs:  Price( Close ), Length( 9 ), Displace( 0 ) ;
variables:  var0( 0 ) ;
	
var0 = AverageFC( Price, Length ) ;
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:
 
Code
inputs:  Price( Close ), Length( 9 ), EntryOffSetInTicks( 1 ) ;
variables:  vAverage ( 0 ) , vOneTick ( 0 ), EntryOffSet ( 0 );

//compute minimum move and order offset
once
begin
	vOneTick = MinMove / PriceScale ;
	EntryOffSet = vOneTick * EntryOffSetInTicks ;
end;
	
//compute average
vAverage = AverageFC( Price, Length ) ;

//send order
if Close < vAverage then	
	Buy ("Long") next bar vAverage + EntryOffSet stop;
Regards,
ABCTG


Follow me on X Reply With Quote
Thanked by:
  #3 (permalink)
jesse514
Montreal, QC
 
Posts: 11 since Apr 2014
Thanks Given: 5
Thanks Received: 6


ABCTG,

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.

Jesse


Reply With Quote
Thanked by:
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

Jesse,

thanks for letting me know. If you have any questions regarding the code just post back here.

Regards,
ABCTG


jesse514 View Post
ABCTG,

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.

Jesse


Follow me on X Reply With Quote




Last Updated on April 10, 2014


© 2026 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 - Downloads - Top
no new posts