Login Page - Create Account

Support Board


Date/Time: Fri, 09 May 2025 21:40:59 +0000



[Programming Help] - Custom Study Compilation Fails —

View Count: 82

[2025-05-06 21:06:07]
User867930 - Posts: 4
Hello Sierra Chart Support,

I'm experiencing a persistent compilation issue while building a custom study from VectorAI.cpp using the Build Advanced Custom Studies interface.

The .cpp file is located in the correct C:\SierraChart\ACS_Source directory, and #include "sierrachart.h" is present. However, I continue to receive the following error:

java
CopyEdit
VectorAI.cpp:5:53: error: two or more data types in declaration of 'scsf_VectorAI'
5 | SCSFExport void scsf_VectorAI(SCStudyInterfaceRef sc)

I’ve confirmed that sierrachart.h is present and that the header is properly included. Despite multiple adjustments, the same error persists during the build process.

I’ve attached the current version of VectorAI.cpp for your review. Any guidance would be greatly appreciated.

Thank you,

Paul Strickland
attachmentVectorAI.cpp.cpp - Attached On 2025-05-06 21:04:49 UTC - Size: 778 B - 13 views
Attachment Deleted.
[2025-05-07 07:57:24]
User431178 - Posts: 669
The code that you've uploaded does not have the error mentioned, it builds correctly.


VectorAI.cpp:5:53: error: two or more data types in declaration of 'scsf_VectorAI'
5 | SCSFExport void scsf_VectorAI(SCStudyInterfaceRef sc)

This is the cause of the error in whatever code you were trying to compile before (based on the error message above).

Incorrect

SCSFExport void scsf_VectorAI(SCStudyInterfaceRef sc)


Correct

SCSFExport scsf_VectorAI(SCStudyInterfaceRef sc)

[2025-05-09 13:00:40]
User867930 - Posts: 4
Hello Sierra Chart Support,

We’ve spent the past two days troubleshooting a custom strategy that compiles, attaches correctly, and logs messages, but no trades are executing, and no trade markers are displayed.

✅ What We’ve Verified:
Strategy compiles and loads without error

Log messages confirm strategy is running and conditionally triggering

Using [Sim] symbols (e.g., NQM25-CME[M])

Trade Activity Log is active and querying without errors

Sim trading mode is enabled

Time zone is synced correctly

"Allow Simulated Resting Limit Order to Fill at Better Price" is enabled

We've run it on aligned Renko and OHLC bar charts

The sc.BuyEntry() function is called and logs confirm it

Tried both actual conditions and a test strategy that simply buys every bar

📄 Test Code (Always Fires Market Orders)
cpp
Copy
Edit
#include "sierrachart.h"
SCDLLName("VectorAI - Always Fire Test")

SCSFExport void scsf_AlwaysBuy(SCStudyInterfaceRef sc)
{
if (sc.SetDefaults)
{
sc.GraphName = "ALWAYS BUY TEST";
sc.AutoLoop = 1;
return;
}

s_SCPositionData position;
sc.GetTradePosition(position);

if (position.PositionQuantity == 0 && sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED)
{
s_SCNewOrder order;
order.OrderType = SCT_ORDERTYPE_MARKET;
order.OrderQuantity = 1;
order.TextTag = "ALWAYS BUY";

int Result = sc.BuyEntry(order);
sc.AddMessageToLog("ALWAYS BUY EXECUTED", 1);
}
}
🔧 Still Seeing:
No trades in Trade Activity log

No markers on chart

No updates to Sim P/L

Message Log confirms code runs, but no execution occurs

📷 Screenshots (Attached):
Trade Simulation settings

Message Log with trigger messages

Trade Activity Log

Chart with strategy attached (no markers shown)

We’re happy to supply anything else needed to resolve this. We’ve ruled out most internal code issues — this feels like something environmental or session-related.

Thank you for your help!

Best regards,
Paul & Ace (ChatGPT)
[2025-05-09 13:11:50]
User431178 - Posts: 669
Not Sierra Chart support, but I answered this and your other post.
The other post has a reply with updated working code, I compliled and tested it.

Custom Study Compiles but Not Recognized or Executed in Chart Replay Mode

Something that you can add to your code that might help if you still have problems.
Add this into the block where you make the buy entry attempt, it adds a message to the trade service log with the error reason.


if (result < 0)
sc.AddMessageToTradeServiceLog(sc.GetTradingErrorTextMessage(result), 0, 1);

Date Time Of Last Edit: 2025-05-09 13:12:34
[2025-05-09 13:21:10]
User867930 - Posts: 4
I have been through 6 different front end applications in the last 2 months searching for SierraChart. I am very pleased with the platform and your customer service is excellent. I am a fan! Thank you so much.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account