Math operations on external symbols
Author: WEALTHPRO25
Creation Date: 6/8/2017 5:21 PM
profile picture

WEALTHPRO25

#1
can you please help me code the following, i have updated fred and i can chart the following symbols IRLTLT01DEM156N and IRLTLT01USM156N, i can see the chart for each one individually, now i want to subtract IRLTLT01DEM156N minus IRLTLT01USM156N and see this graph on the chart, greatly appreciate your assistance, thank you.
profile picture

Eugene

#2
I thought that after having spent a good portion of January 2016 lecturing and exemplifying you've learnt how to use math ops on external symbols?

Combining indicators to make a new indicator

Post #4 - theory
Post #24 - final result

Consider this snippet from that year-old discussion with you:

CODE:
Please log in to see this code.


Imagine that the totalpc and pcrEQ are IRLTLT01DEM156N and IRLTLT01USM156N's Close prices, accordingly - just change the strings to your new symbols. Below you have a multiplication on those DataSeries: subtraction is just as easy. Finally, the plotting.

What is not clear?
profile picture

WEALTHPRO25

#3
i tried with this code

CODE:
Please log in to see this code.


too many error codes



i have the follwoing code, it complies but when i do monthly chart with symbol irltlt01dem156N or irltlt01us156N i get the following error

runtime error, object reference not set to an instance of an object


this is the code that compiles but runtime error

CODE:
Please log in to see this code.
profile picture

Eugene

#4
QUOTE:
runtime error, object reference not set to an instance of an object

Then your DataSet name is not called "FRED" but it must match the string you have in GetExternalSymbol. Altnernative: use the other call to GetExternalSymbol as shown in code below. Also, I think you'd want to "remove" the PricePane and replace it with your synthetic symbol:

CODE:
Please log in to see this code.
profile picture

WEALTHPRO25

#5
thank you very much for your help
profile picture

Eugene

#6
Glad to help.
profile picture

Eugene

#7
wealthpro25's post moved from a different (less related) thread:

for the code below, i want the output of the graph ds2-ds1 and use this data to plot the macd reverse engineering strategy, so as follows

CODE:
Please log in to see this code.

take the data series from above ds2 - ds1 and use this for input in

CODE:
Please log in to see this code.


please help thank you
profile picture

Eugene

#8
1. Move relevant code that builds DataSeries from #1 to #2, placing it before the HideVolume():

CODE:
Please log in to see this code.


2. Now, replace the Close in #2 with dsSubtraction as shown below:

CODE:
Please log in to see this code.


That's it. Very simple:

CODE:
Please log in to see this code.
profile picture

WEALTHPRO25

#9
thank you, with the code above i just see the chart for ds2 - ds1, but i do not see the reverse engineering macd chart with the blue dotted line and i do not see the macd histogram, macd and macd signal

i put either IRLTLT01DEM156N or IRLTLT01US156N into the symbol box and get only the chart for ds2 - ds1
profile picture

Eugene

#10
CODE:
Please log in to see this code.
profile picture

WEALTHPRO25

#11
ok got it, is it possible to chart both the ds2 - ds1 and the reverse engineering blue line on the same chart, i am able to chart them separately,

the reverse engineering chart is there but with that the graph is for the symbol IRLTLT01DEM156N or symbol IRLTLT01US156N

the graph is not for ds2 - ds1 which i want to see on the same chart as the reverse engineering graph, thanks
profile picture

Eugene

#12
QUOTE:
the graph is not for ds2 - ds1 which i want to see on the same chart as the reverse engineering graph, thanks

Please note that neither endless code customizations nor teaching how to program are part of our support duty. Nonetheless, this is what we've been doing for 2 years. If you go over our replies you'll see there's a lot of pointers and examples showing you how to use PlotSeries, ChartPane etc. However, you don't seem to be making progress as proven by my post #2 above as I have to re-do something that I've already shown before.

I leave this task up to you, hoping that you listen to our advice and learn some C# 101 on your own. While you're at it, do not come back immediately on getting a compiler error, as you're used to. Like I taught you in 2015, "don't hesitate to be curious about the error you're getting. Notice the line, find the method which triggered it, highlight it and hit F1 to open the QuickRef tool with more details about possible errors."

And as I prompted back in 2016, "show us that you learn C# 101 and not just keep doing the same thing (mistake) over and over. There are a large number of free web resources, books, tutorials (even on our Wiki FAQ) to help out in your C# study."

Good luck with your venture!
profile picture

WEALTHPRO25

#13
ok i was able to plot it, thanks
profile picture

Eugene

#14
Glad to help.
profile picture

WEALTHPRO25

#15
can you help me put the data series for dsSubtraction for the leader of macd code below

CODE:
Please log in to see this code.

thanks
profile picture

Eugene

#16
No. As LeaderOfMACD operates on Bars, it cannot be applied to the dsSubtraction which is a DataSeries.
profile picture

Eugene

#17
On a second thought, it's possible to rewrite the LeaderOfMACD to accept your external DataSeries as follows:

CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).