(Clarifying: I am not english-spanish bilingual, so please excuse my grammar and other mistakes)
Hi,
I am just trying to reproduce on C++ the "SimpleSMA Strategy" example writed on Delphi, and after that make my own improvements to this strategy. This because I have a little experience with C++ but not with Delphi.
When I run my C++ strategy I obtain results on the "Optimization properties" Tab showed on attached "Properties1.JPG" file, where on TimeFrame option the displayed value is "3" that it corresponds to the constant PERIOD_H1.
I want to reproduce the exact behaviour of the "Simple SMA Strategy" already instaled as example with the ForexTester application, which shows the image attached as "Properties2.JPG" file with PERIOD_H1 as displayed value.
This is my "partial" C++ source code (What´s wrong or missing?):
//--------------------------------------------------------------------------
// RGM C++ Test: Strategy based on 2 crossing SMA
//--------------------------------------------------------------------------
#include <windows.h>
#include "StrategyInterfaceUnit.h"
#include "TechnicalFunctions.h"
#include "Graphics.h"
#include "SimpleSMA.h"
// external parameters
PChar Currency = NULL;
int TimeFrame;
double LotSize;
int period1;
int period2;
// internal variables
int OrderHandle;
TTradePositionType OrderStyle;
TDateTime OpenTime;
//-----Init strategy----------------------------------------------------------
EXPORT void __stdcall InitStrategy()
{
StrategyShortName("RGM: Simple two SMA strategy");
StrategyDescription("RGM: Strategy based on 2 crossing SMA");
// Register external parameters
RegOption("Currency", ot_Currency, &Currency);
ReplaceStr(Currency, "EURUSD");
RegOption("TimeFrame", ot_Integer, &TimeFrame);
TimeFrame = PERIOD_H1;
RegOption("LotSize", ot_double, &LotSize);
SetOptionDigits("LotSize",1);
LotSize = 0.1;
RegOption("Period1", ot_Integer, &period1);
SetOptionRange("SMA1 Period",2,INT_MAX);
period1 = 16;
RegOption("Period2", ot_Integer, &period2);
SetOptionRange("SMA2 Period",2,INT_MAX);
period2 = 32;
}
...
Thanks in advance.
RegOption("TimeFrame", ..... behaviour in C++
-
- Posts: 2
- Joined: Thu Apr 24, 2008 8:00 am
- Location: Bogotá - Colombia
RegOption("TimeFrame", ..... behaviour in C++
- Attachments
-
- Original Delphi "Simple SMA Strategy" "optimization properties" tab.
- Properties2.JPG (28.19 KiB) Viewed 8124 times
-
- My C++ "Simple SMA Strategy" "optimization properties" tab.
- Properties1.JPG (27.29 KiB) Viewed 8124 times
Regards,
Richard Giménez Méndez
Richard Giménez Méndez
-
- Posts: 72
- Joined: Wed Apr 23, 2008 12:24 pm
//--------------------------------------------------------------------------
// RGM C++ Test: Strategy based on 2 crossing SMA
//--------------------------------------------------------------------------
#include <windows.h>
#include "StrategyInterfaceUnit.h"
#include "TechnicalFunctions.h"
#include "Graphics.h"
#include "SimpleSMA.h"
// external parameters
PChar Currency = NULL;
int TimeFrame;
double LotSize;
int period1;
int period2;
// internal variables
int OrderHandle;
TTradePositionType OrderStyle;
TDateTime OpenTime;
//-----Init strategy----------------------------------------------------------
EXPORT void __stdcall InitStrategy()
{
StrategyShortName("RGM: Simple two SMA strategy");
StrategyDescription("RGM: Strategy based on 2 crossing SMA");
// Register external parameters
RegOption("Currency", ot_Currency, &Currency);
ReplaceStr(Currency, "EURUSD");
RegOption("TimeFrame", ot_TimeFrame, &TimeFrame);
TimeFrame = PERIOD_H1;
RegOption("LotSize", ot_double, &LotSize);
SetOptionDigits("LotSize",1);
LotSize = 0.1;
RegOption("Period1", ot_Integer, &period1);
SetOptionRange("SMA1 Period",2,INT_MAX);
period1 = 16;
RegOption("Period2", ot_Integer, &period2);
SetOptionRange("SMA2 Period",2,INT_MAX);
period2 = 32;
}
...
// RGM C++ Test: Strategy based on 2 crossing SMA
//--------------------------------------------------------------------------
#include <windows.h>
#include "StrategyInterfaceUnit.h"
#include "TechnicalFunctions.h"
#include "Graphics.h"
#include "SimpleSMA.h"
// external parameters
PChar Currency = NULL;
int TimeFrame;
double LotSize;
int period1;
int period2;
// internal variables
int OrderHandle;
TTradePositionType OrderStyle;
TDateTime OpenTime;
//-----Init strategy----------------------------------------------------------
EXPORT void __stdcall InitStrategy()
{
StrategyShortName("RGM: Simple two SMA strategy");
StrategyDescription("RGM: Strategy based on 2 crossing SMA");
// Register external parameters
RegOption("Currency", ot_Currency, &Currency);
ReplaceStr(Currency, "EURUSD");
RegOption("TimeFrame", ot_TimeFrame, &TimeFrame);
TimeFrame = PERIOD_H1;
RegOption("LotSize", ot_double, &LotSize);
SetOptionDigits("LotSize",1);
LotSize = 0.1;
RegOption("Period1", ot_Integer, &period1);
SetOptionRange("SMA1 Period",2,INT_MAX);
period1 = 16;
RegOption("Period2", ot_Integer, &period2);
SetOptionRange("SMA2 Period",2,INT_MAX);
period2 = 32;
}
...
- Attachments
-
- Capture_123.jpg (21.14 KiB) Viewed 8119 times
Who is online
Users browsing this forum: No registered users and 20 guests