NexusFi: Find Your Edge


Home Menu

 





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


Discussion in MultiCharts

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




 
Search this Thread

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

  #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?
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
Trade idea based off three indicators.
Traders Hideout
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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 Twitter 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,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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 Twitter Reply With Quote




Last Updated on April 10, 2014


© 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