Support Board
Date/Time: Sun, 22 Dec 2024 03:19:20 +0000
[User Discussion] - Pain in the head trying to add a moving average to this study
View Count: 986
[2015-04-15 20:16:24] |
Sebastian_M - Posts: 70 |
Hi gang, I am trying to add a moving average to this study, if the close is above, then green. Can anyone help me please? I did add a moving average to it, but I don't think I understand enough to make it work. Thank you in advance Date Time Of Last Edit: 2015-04-15 20:17:07
|
Seb_Code_Test.cpp - Attached On 2015-04-15 20:15:49 UTC - Size: 2.47 KB - 454 views |
[2015-04-16 08:27:20] |
ehlaban - Posts: 50 |
You already have a MA in your code: sc.MovingAverage(sc.BaseDataIn[SC_LAST], sc.Subgraph[0], MOVAVGTYPE_SIMPLE, 50); the input is: sc.BaseDataIn[SC_LAST] the output is: sc.Subgraph[0] Watch out you don't use a sc.Subgraph[0] again, use sc.Subgraph[1] etc You now have 2 sc.Subgraph[0] and that doesn't work. See also: http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html#scMovingAverage |
[2015-04-16 09:49:09] |
Sebastian_M - Posts: 70 |
Hi ehlaban, I changed the subgraph to 1 on the float line, also I looked at the link as I was writing the code, but I do not understand how I just reference the MA, as I do not want to display it on the chart. Am I leaving out any code from the link? I tried to compile and get this error. -- Starting build of Custom Studies Source files: Seb_Code_Test.cpp. -- 10:42:25 "C:\SierraChart\CPPCompiler\bin\g++.exe" "C:\SierraChart\ACS_Source\Seb_Code_Test.cpp" -march=i686 -mtune=i686 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions -o "C:\SierraChart\Data\Seb_Code_Test.dll" C:\SierraChart\ACS_Source\Seb_Code_Test.cpp: In function 'void scsf_Seb_Rising_test(SCStudyInterfaceRef)': C:\SierraChart\ACS_Source\Seb_Code_Test.cpp:53:2: error: expected ')' before '{' token { ^ C:\SierraChart\ACS_Source\Seb_Code_Test.cpp:67:1: error: expected primary-expression before '}' token } ^ C:\SierraChart\ACS_Source\Seb_Code_Test.cpp:67:1: error: expected ';' before '}' token -- End of Build -- 10:42:26 any help would be greatly appreciated Date Time Of Last Edit: 2015-04-16 09:49:44
|
Seb_Code_Test.cpp - Attached On 2015-04-16 09:45:53 UTC - Size: 2.48 KB - 428 views |
[2015-04-16 10:12:34] |
ehlaban - Posts: 50 |
It's totally unclear what you want to do. Why do you need a MA and what do you want to display on your chart? Here's a little better version. |
Seb_Code_Test (1).cpp - Attached On 2015-04-16 10:12:15 UTC - Size: 2.22 KB - 324 views |
[2015-04-16 10:38:40] |
Sebastian_M - Posts: 70 |
Hi ehlaban, Thank you for your reply, what I am trying to do is this, if a certain criteria is met, and it is above a moving average, then I want to generate a signal to evaluate. n getting this right, I want a create a template to develop further. I am looking to display the array signal onto the chart. Thank you. |
[2015-04-16 17:54:32] |
ehlaban - Posts: 50 |
This one works.
|
Attachment Deleted. SebCodeTest.cpp - Attached On 2015-04-16 17:54:06 UTC - Size: 2.27 KB - 370 views |
[2015-04-16 18:14:42] |
Sebastian_M - Posts: 70 |
Hey ehlaban, I cannot thank you enough, I would have struggled through that. I hope to learn for the future, but no examples on the board, I did try to find other cpp files, but could not. Regards S |
To post a message in this thread, you need to log in with your Sierra Chart account: