Login Page - Create Account

Support Board


Date/Time: Sat, 04 Apr 2026 08:24:38 +0000



[Programming Help] - Auto trade not working

View Count: 135

[2026-04-01 15:40:25]
User587676 - Posts: 11
I am attempting to utilize an auto trading strategy. It works on first try then will not enter the trade. Here is what the programmer asked me to send. "sc.SellEntry() returns -1 on sim account with AutoLoop=0, UpdateAlways=1, bare market order, no working orders, flat position, all auto-trade settings enabled" Can you help.
[2026-04-02 14:40:41]
User587676 - Posts: 11
sc.SellOrder() returns -1 on Sim1 account. Auto-trading enabled, flat position, no working orders, Risk Manager off. Happens with both sc.SellOrder and sc.SellEntry. Manual orders from trade window work fine. Started happening with new ACSIL studies — existing older studies trade correctly.
[2026-04-02 15:08:07]
User431178 - Posts: 857
Can you help.
Yes, find a new programmer...

Here is what the programmer asked me to send. "sc.SellEntry() returns -1 on sim account with AutoLoop=0, UpdateAlways=1, bare market order, no working orders, flat position, all auto-trade settings enabled"
Anything in the trade service log?
How about getting the actual error message details printed?
Automated Trading From an Advanced Custom Study: sc.GetTradingErrorTextMessage()


Is the return value always -1 or some other of the order error constants?
Automated Trading From an Advanced Custom Study: Order Error Constants


Started happening with new ACSIL studies — existing older studies trade correctly
So something is misconfigured in the new study, have you made comparison between what you have that works and what doesn't?


You said this
It works on first try then will not enter the trade

So does that mean somewhere in the code you are changing some config option that is preventing you from entering again?

Can you provide more context, maybe some code, e.g. what is set in the 'SetDefaults' block?
[2026-04-02 16:09:37]
User587676 - Posts: 11
STrig=1 CanSend=1 EntryRes=-1 with empty message log despite sc.AddMessageToLog(msg,1) in the rejection handler. I have tried to attached 2 files. Don't seem to be there.
Private File
Private File
[2026-04-02 16:36:07]
User431178 - Posts: 857
STrig=1 CanSend=1 EntryRes=-1
This is meaningless without surrounding context.

I have tried to attached 2 files. Don't seem to be there.
You would need to make them public so that they are visible.
[2026-04-02 16:48:36]
User587676 - Posts: 11
i am sorry I am new to this strategy.
imageScreenshot 2026-04-02 120004.jpg / V - Attached On 2026-04-02 16:47:24 UTC - Size: 185.73 KB - 11 views
attachmentBasic2LineCopilot.cpp - Attached On 2026-04-02 16:47:43 UTC - Size: 40.56 KB - 6 views
Attachment Deleted.
[2026-04-02 16:51:53]
User587676 - Posts: 11
the basic premise is it has to cross the top anchor to arm at 4 ticks right now then on return it enters a trade at that anchor reentry but it goes either from arm to ready or stays armed depending on which one of the studies i am using and then the vice versa for the lower anchor. Also if it is stopped out it can reload as long as it is past the 4 ticks set to arm
Date Time Of Last Edit: 2026-04-02 16:53:06
[2026-04-02 18:29:27]
ForgivingComputers.com - Posts: 1209
This is what happens when you try to create custom studies with AI tools. They can get you most of the way there, but you can still run into problems, as you are seeing.

Not only do you want a free study you want free advice on fixing it.
[2026-04-02 21:23:18]
User587676 - Posts: 11
i did not invent AI or make it free and I pay a lot of money over the years to this company. Frankly your attitude is very unprofessional and how it gets done is not your concern. I am sure i am not the only person using Ai out there. Do you have a supervisor I can speak with?
[2026-04-02 23:41:24]
ForgivingComputers.com - Posts: 1209
I am sure i am not the only person using Ai out there.

I am not criticizing you for using AI. I use it myself. I am pointing out that as a tool it can be useful, but not perfect.

Sorry if I sound flippant, but your initial inquiries were so vague that there was really not enough information to help you. When you posted the code, it was obvious it came from an CoPilot. I have seen numerous posts from people who try something and get stuck when it doesn't work. I have helped a lot of people on this board when the answer is straightforward. I could probably fix your problem in less than an hour. However, it would take some time to understand what is going on, since I didn't write it, and then time to fix it. That I would be happy to charge you for.

Brad Houser
Owner, Forgiving Computers
[2026-04-03 00:01:55]
User587676 - Posts: 11
NO worries. Just for the record my AI is not free and most Free AI could not do it. It is working fine for now. Just out of curiosity how many other people have to pay to use this board? I wish you the best and Happy Easter.

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

Login

Login Page - Create Account