Installing an indicator
-
- Posts: 6
- Joined: Sat Jan 28, 2012 2:54 pm
Installing an indicator
Hi,
Am using FT 2 Demo version. While installing the indicator in FT get an error, the screenshot of same enclosed.
The indicator is built in VC++ 10.0 dll, as per the sample given in Examples directory and compiles cleanly without any errors/warnings.
Am using FT 2 Demo version. While installing the indicator in FT get an error, the screenshot of same enclosed.
The indicator is built in VC++ 10.0 dll, as per the sample given in Examples directory and compiles cleanly without any errors/warnings.
- Attachments
-
- FT Error.JPG (17.87 KiB) Viewed 40838 times
-
- Posts: 151
- Joined: Tue Feb 24, 2009 1:03 pm
-
- Posts: 6
- Joined: Sat Jan 28, 2012 2:54 pm
As the problem is with installation of dll not sure, posting of code will help. Anyways my indicator dll is attached.
- Attachments
-
- MOVE 3.0.dll
- (131 KiB) Downloaded 1209 times
-
- Posts: 151
- Joined: Tue Feb 24, 2009 1:03 pm
When I have seen this error in the past it's always been the result of badly constructed code. Code has no compilation errors but has errors relating to how FT uses it. FT recognizes this and refuses to install it. Thats why I suggested posting the code.
P.S. Check the number of indicator buffers declared in code is correct as an incorrect number is often the cause.
P.S. Check the number of indicator buffers declared in code is correct as an incorrect number is often the cause.
-
- Posts: 6
- Joined: Sat Jan 28, 2012 2:54 pm
Am using 8 Indicators. def and c file enclosed.
Def File
C File
[/code]
Def File
Code: Select all
LIBRARY Move
EXPORTS Init @1
Calculate @2
ReplaceStr @3
IntrfProcsRec @4
OnParamsChange @5
C File
Code: Select all
#include <windows.h>
#include <IndicatorInterfaceUnit.h>
#define EMPTY_VALUE 0x7FFFFFFF
#define EMPTY -1
#define WHOLE_ARRAY 0
#define VK_J 74
#define releaseNameDef "!MOVE v 3.1 ForexTester (20111225.1700)"
#define copyRightDef "AwarenessForex.com © 2011"
int MoveIgnoreDistance;
double RetracementQualifier;
HWND WindowHandle;
TIndexBuffer Down1;
TIndexBuffer Down2;
TIndexBuffer Down3;
TIndexBuffer Down4;
TIndexBuffer Up1;
TIndexBuffer Up2;
TIndexBuffer Up3;
TIndexBuffer Up4;
extern "C" void __stdcall Init() {
// Indicator Variables
// define properties
IndicatorShortName("Move 3.1 ForexTester");
SetOutputWindow(ow_ChartWindow);
// register options
AddSeparator("Common");
RegOption("EA_ID", ot_Integer, &EA_ID);
EA_ID = "";
RegOption("MoveComplete", ot_PChar, &MoveComplete);
SetOptionRange("MoveComplete", 1, 100000);
MoveComplete = 80;
Down1 = CreateIndexBuffer();
Down2 = CreateIndexBuffer();
Down3 = CreateIndexBuffer();
Down4 = CreateIndexBuffer();
Up1 = CreateIndexBuffer();
Up2 = CreateIndexBuffer();
Up3 = CreateIndexBuffer();
Up4 = CreateIndexBuffer();
IndicatorBuffers(8);
//SetEmptyValue(EMPTY_VALUE);
// Initialize the indicators
SetIndexBuffer(0, Down1);
SetIndexStyle(0, ds_Line, psSolid, 1, clRed);
SetIndexLabel(0, "Down1");
SetIndexBuffer(1, Down2);
SetIndexStyle(1, ds_Line, psSolid, 1, clRed);
SetIndexLabel(1, "Down2");
SetIndexBuffer(2, Down3);
SetIndexStyle(2, ds_Histogram, psSolid, 1, clRed);
SetIndexLabel(2, "Down3");
SetIndexBuffer(3, Down4);
SetIndexStyle(3, ds_Histogram, psSolid, 1, clRed);
SetIndexLabel(3, "Down4");
SetIndexBuffer(4, Up1);
SetIndexStyle(4, ds_Line, psSolid, 1, clYellow);
SetIndexLabel(4, "Up1");
SetIndexBuffer(5, Up2);
SetIndexStyle(5, ds_Line, psSolid, 1, clYellow);
SetIndexLabel(5, "Up2");
SetIndexBuffer(6, Up3);
SetIndexStyle(6, ds_Histogram, psSolid, 1, clYellow);
SetIndexLabel(6, "Up3");
SetIndexBuffer(7, Up4);
SetIndexStyle(7, ds_Histogram, psSolid, 1, clYellow);
SetIndexLabel(7, "Up4");
return;
}
extern "C" void __stdcall OnParamsChange()
{
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
extern "C" void __stdcall Calculate(int index) {
}
-
- Posts: 103
- Joined: Sun Jan 02, 2011 6:05 pm
These statements seen some mistake:
ED_ID is ot_Integer, but you assign EA_ID = ""
RegOption("EA_ID", ot_Integer, &EA_ID);
EA_ID = "";
MoveComplete should be ot_Interger, but you use ot_PChar
RegOption("MoveComplete", ot_PChar, &MoveComplete);
SetOptionRange("MoveComplete", 1, 100000);
MoveComplete = 80;
ED_ID is ot_Integer, but you assign EA_ID = ""
RegOption("EA_ID", ot_Integer, &EA_ID);
EA_ID = "";
MoveComplete should be ot_Interger, but you use ot_PChar
RegOption("MoveComplete", ot_PChar, &MoveComplete);
SetOptionRange("MoveComplete", 1, 100000);
MoveComplete = 80;
-
- Posts: 6
- Joined: Sat Jan 28, 2012 2:54 pm
-
- Posts: 905
- Joined: Sat Jul 11, 2009 10:54 am
- Tantalus
- Posts: 302
- Joined: Fri Mar 23, 2007 3:51 pm
- Contact:
In a case like this, my recommendation is to comment out all active code (lines that do not make up the 'skeleton' of the indicator) and compile to see if it will run. You will essentially be making an indicator that does nothing, but it should be able to 'run' successfully.
Then, start un-commenting lines of code one by one and recompiling and running until to come to a line which causes the crash. It sounds tedious, I know, but it's a sure way to find out exactly what FT is choking on in cases like this where the code compiles perfectly but gives run-time errors.
Then, start un-commenting lines of code one by one and recompiling and running until to come to a line which causes the crash. It sounds tedious, I know, but it's a sure way to find out exactly what FT is choking on in cases like this where the code compiles perfectly but gives run-time errors.
Tantalus Research - Developing 21st Century Trading Systems.
-
- Posts: 905
- Joined: Sat Jul 11, 2009 10:54 am
Tantalus wrote:In a case like this, my recommendation is to comment out all active code (lines that do not make up the 'skeleton' of the indicator) and compile to see if it will run. You will essentially be making an indicator that does nothing, but it should be able to 'run' successfully.
Then, start un-commenting lines of code one by one and recompiling and running until to come to a line which causes the crash. It sounds tedious, I know, but it's a sure way to find out exactly what FT is choking on in cases like this where the code compiles perfectly but gives run-time errors.
Thank you Tantalus, this is the best way to find an issue which causes indicator crash
Check our other product here:
http://www.forexcopier.com
http://www.forexcopier.com
-
- Posts: 63
- Joined: Tue Oct 12, 2010 6:45 pm
AnkaSoftware,
To get indicators to work with C++, you need to install teh MSVC libs on the PC you are using FT on. This will most likely solve your problem.
Look at the MACDx that I've build in Visual C++:
http://www.forextester.com/forum/viewto ... light=macd
There is a readme that explains with libs you need to install to get indicators to work that where build with Visual C++
Wessel
To get indicators to work with C++, you need to install teh MSVC libs on the PC you are using FT on. This will most likely solve your problem.
Look at the MACDx that I've build in Visual C++:
http://www.forextester.com/forum/viewto ... light=macd
There is a readme that explains with libs you need to install to get indicators to work that where build with Visual C++
Wessel
-
- Posts: 6
- Joined: Sat Jan 28, 2012 2:54 pm
Hi All,
Thanks for the suggestions.
I have full version of VS 2010 installed and MSVCP100.dll is already installed.
I isolated the problem to calls to the following ForexTester Functions - Symbol(), Digits() and Point(). Replacing these function call and replacing them by hardcoded values, does not throw any errors while installing the indicator in ForexTester (refer to screen shots attached earlier in the thread).
Any workaround for this problem? Or I need to build a separate dll for each pair I want to test on?
Thanks for the suggestions.
I have full version of VS 2010 installed and MSVCP100.dll is already installed.
I isolated the problem to calls to the following ForexTester Functions - Symbol(), Digits() and Point(). Replacing these function call and replacing them by hardcoded values, does not throw any errors while installing the indicator in ForexTester (refer to screen shots attached earlier in the thread).
Any workaround for this problem? Or I need to build a separate dll for each pair I want to test on?
- Tantalus
- Posts: 302
- Joined: Fri Mar 23, 2007 3:51 pm
- Contact:
Again, it's impossible to know what might be the problem without seeing your code. The functions you mention are typical built-in API functions so if they are throwing exceptions I must assume it's because of the way they are being used. Without seeing the code itself there's no way we can help you to figure out what you've done wrong.
Just post the code files zipped up.. it would be easier to review that way than pasting the text into the message.
Just post the code files zipped up.. it would be easier to review that way than pasting the text into the message.
Tantalus Research - Developing 21st Century Trading Systems.
-
- Posts: 6
- Joined: Sat Jan 28, 2012 2:54 pm
Thanks for your reply.
I am using standard methods of accessing the string returned by function Symbol(). For each of the method I am running into same memory access error thrown by ForexTester (screenshot in the first mail of this thread).
Tried the following:
char* symbol;
with
symbol = Symbol();
ReplaceStr(symbol, Symbol());
char symbol[6];
with
memcpy(symbol, Symbol(), 6);
strcpy(symbol, Symbol());
etc
I am using standard methods of accessing the string returned by function Symbol(). For each of the method I am running into same memory access error thrown by ForexTester (screenshot in the first mail of this thread).
Tried the following:
char* symbol;
with
symbol = Symbol();
ReplaceStr(symbol, Symbol());
char symbol[6];
with
memcpy(symbol, Symbol(), 6);
strcpy(symbol, Symbol());
etc
-
- Posts: 7
- Joined: Wed May 15, 2013 4:12 pm
Status on this issue
I am having the same issue with an access violation when trying to install my indicator written in c++. I have commented code and narrowed it down to this line:
multiply = pow(10.0, Digits());
Has there been any progress on this issue or any resolution?
Thanks!
multiply = pow(10.0, Digits());
Has there been any progress on this issue or any resolution?
Thanks!
-
- Posts: 103
- Joined: Sun Jan 02, 2011 6:05 pm
Re: Status on this issue
edoughig wrote:I am having the same issue with an access violation when trying to install my indicator written in c++. I have commented code and narrowed it down to this line:
multiply = pow(10.0, Digits());
Has there been any progress on this issue or any resolution?
Thanks!
The problem is not on the pow function.
The problem is on the Digits() function, you can test it out using
x =Digits()
during the initialization, the access violation still will throw out.
Even Delphi version also the same issue.
During Init(), likely the Digits() is not properly intialize yet.
To solve that, move it to Calculate() function.
-
- Posts: 7
- Joined: Wed May 15, 2013 4:12 pm
Re: Status on this issue
KelvinHand wrote:edoughig wrote:I am having the same issue with an access violation when trying to install my indicator written in c++. I have commented code and narrowed it down to this line:
multiply = pow(10.0, Digits());
Has there been any progress on this issue or any resolution?
Thanks!
The problem is not on the pow function.
The problem is on the Digits() function, you can test it out using
x =Digits()
during the initialization, the access violation still will throw out.
Even Delphi version also the same issue.
During Init(), likely the Digits() is not properly intialize yet.
To solve that, move it to Calculate() function.
Sure enough, that was the fix. Thanks again for the help and quick response!
Who is online
Users browsing this forum: No registered users and 20 guests