Forex Tester Forum (Professional Training Software for Traders) Forum Index Forex Tester Forum (Professional Training Software for Traders)

Back to main site   Risk disclosure
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

building using Delphi 2010
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> Programming lessons
View previous topic :: View next topic  
Author Message
eklavya



Joined: 11 Jun 2008
Posts: 5

PostPosted: Sat Aug 07, 2010 3:17 am    Post subject: building using Delphi 2010 Reply with quote

Hi,

I am trying to build an indicator using Delphi 2010. I am getting the dll fild created and am able to add it successfully. However, when I try to add the indicator to the chart, I can only see the first character of the indicator short name in this case "t" and not the expected "test1".

In fact when I compile any existing FT indicator such as MACD and install the dll file and the upon add the indicator to the chart I see only "M" and not "MACD"

Here is the code. Appreciate any help on this.

Code:
library test1;

uses
  SysUtils, classes, graphics, math, IndicatorInterfaceUnit, TechnicalFunctions;

  //---------------------------------------------------------------------------
// Initialization
//---------------------------------------------------------------------------
procedure Init; stdcall;
begin
  // define parameters
  IndicatorShortName('test1');
  SetOutputWindow(ow_ChartWindow);
end;

//---------------------------------------------------------------------------
// Deinitialization
//---------------------------------------------------------------------------
procedure Done; stdcall;
begin
end;

//---------------------------------------------------------------------------
// Calculate bar
//---------------------------------------------------------------------------
procedure Calculate(index: integer); stdcall;
begin
end;

exports
Init, Done, Calculate;
end.
Back to top
View user's profile Send private message
FT Support



Joined: 11 Jul 2009
Posts: 901

PostPosted: Sat Aug 07, 2010 5:40 am    Post subject: Reply with quote

Hello,

This problem appears because in new delphi version "string" means unicode string but in old delphi version "string" was equal to "AnsiString".
Forex Tester requires all strings in AnsiString format, so please do the following to fix this issue:

1) use attached API libraries. We'll include these libraries into Forex Tester 2.6.

2) change type for all "string" variables to "AnsiString"

_________________
Check our other products here:
www.fx-metropolis.com
www.forexcopier.com


Last edited by FT Support on Tue Aug 10, 2010 7:46 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
eklavya



Joined: 11 Jun 2008
Posts: 5

PostPosted: Sat Aug 07, 2010 2:32 pm    Post subject: Reply with quote

Hello..thank you..

I don't have too much of a coding experience...can you please advice on how exactly I can do the above.

What changes will I have to make to the code above to make it work?
Back to top
View user's profile Send private message
eklavya



Joined: 11 Jun 2008
Posts: 5

PostPosted: Mon Aug 09, 2010 9:04 pm    Post subject: Reply with quote

Could you please kindly help out with this issue?
Back to top
View user's profile Send private message
FT Support



Joined: 11 Jul 2009
Posts: 901

PostPosted: Tue Aug 10, 2010 8:03 am    Post subject: Reply with quote

Hello,

Just try to download attached API and replace your versions of "TechnicalFunctions.pas" and "IndicatorInterfaceUnit.pas" files.

No changes are required in your code for now.

Let me know if you still have problems with this.

_________________
Check our other products here:
www.fx-metropolis.com
www.forexcopier.com
Back to top
View user's profile Send private message Visit poster's website
hjabu



Joined: 21 Aug 2009
Posts: 30

PostPosted: Tue Apr 19, 2011 2:31 pm    Post subject: How to compile TPL to dpr Reply with quote

eklavya,

Hi , i ,m new using delphi xe, for compiling my tpl file indicator, couldgive some tips how do i start using Delphi xe, to convert tpl into dpr and dll please.. Thank you
Back to top
View user's profile Send private message MSN Messenger
FT Support



Joined: 11 Jul 2009
Posts: 901

PostPosted: Tue Apr 19, 2011 8:36 pm    Post subject: Reply with quote

Hello,

Sorry but "tpl" is not an indicator, is it correct that you need to convert a template?

_________________
Check our other products here:
www.fx-metropolis.com
www.forexcopier.com
Back to top
View user's profile Send private message Visit poster's website
hjabu



Joined: 21 Aug 2009
Posts: 30

PostPosted: Tue Apr 19, 2011 11:23 pm    Post subject: Tpl to dpr and dll Reply with quote

eklavya,

Yes it is template , so how do you convert them using delphi...
Back to top
View user's profile Send private message MSN Messenger
hjabu



Joined: 21 Aug 2009
Posts: 30

PostPosted: Tue Apr 19, 2011 11:28 pm    Post subject: Template convert to dpr and dll Reply with quote

Picture chart look like this:[/img]
Back to top
View user's profile Send private message MSN Messenger
FT Support



Joined: 11 Jul 2009
Posts: 901

PostPosted: Wed Apr 20, 2011 8:27 am    Post subject: Reply with quote

Hmm, i'm pretty sure that this template uses some indicators that have to be converted into FT format as well. Please contact Tantalus (member of our forum), I think that he can help you with the conversion.
_________________
Check our other products here:
www.fx-metropolis.com
www.forexcopier.com
Back to top
View user's profile Send private message Visit poster's website
hjabu



Joined: 21 Aug 2009
Posts: 30

PostPosted: Wed Apr 20, 2011 8:58 am    Post subject: Cannot get "Init proc address" Reply with quote

I have found my tpl to dpr succeded converted and copile it to dll, afther that i ve try to install at my Forex tester it appear repor:

Cannot get "Init proc address"

Please could somone experties in delphi to solve this problem,, do i miss something a code that should i add them?

because i ,m get use to create using delphi now .
Back to top
View user's profile Send private message MSN Messenger
FT Support



Joined: 11 Jul 2009
Posts: 901

PostPosted: Thu Apr 21, 2011 8:31 am    Post subject: Reply with quote

Please see the answer here:
http://forextester.com/forum/viewtopic.php?t=2476

_________________
Check our other products here:
www.fx-metropolis.com
www.forexcopier.com
Back to top
View user's profile Send private message Visit poster's website
hjabu



Joined: 21 Aug 2009
Posts: 30

PostPosted: Sun Apr 24, 2011 8:24 pm    Post subject: recreate the indicators code Reply with quote

Hi , i have re write the code using delphi , could you please check my code as shown below:
//---------------------------------------------------------------------------
// idyllictrading
//---------------------------------------------------------------------------
library idyllictrading;



uses
SysUtils,
classes,
graphics,
math,
DateUtils,
IndicatorInterfaceUnit,
TechnicalFunctions in 'TechnicalFunctions.pas';

var
//THVSDXTzPivots
;Local _HrsServerTzFromGMT=0
Destination _HrsNewTZfromGMT=0
Show_1Daily_2FibonacciPivots=2
FullScreenLines:0
__withMarginPrices=1
MoveLabels_LR_DecrIncr=0
R5_Color:2237106
R5_LineStyle_01234=2
R5_SolidLineThickness=1
R4_Color=2237106
R4_LineStyle_01234=2
R4_SolidLineThickness=1
R3_Color=2237106
R3_LineStyle_01234=2
R3_SolidLineThickness=1
R2_Color=1973915
R2_LineStyle_01234=2
R2_SolidLineThickness=1
R1_Color=1513341
R1_LineStyle_01234=2
R1_SolidLineThickness=1
CentralPivotColor=6447616
CentralPivotLineStyle_01234=0
CentralPivotSolidLineThickness=1
S1_Color=25600
S1_LineStyle_01234=2
S1_SolidLineThickness=1
S2_Color=32768
S2_LineStyle_01234=2
S2_SolidLineThickness=1
S3_Color=2263842
S3_LineStyle_01234=2
S3_SolidLineThickness=1
S4_Color=2263842
S4_LineStyle_01234=2
S4_SolidLineThickness=1
S5_Color=2263842
S5_LineStyle_01234=2
S5_SolidLineThickness=1
MidPivotsColor=25186
MidPivotsLineStyle_01234=2
MidPivotsLineThickness=1
ShowMidPivots=0
QtrPivotsColor=1262987
QtrPivotsLineStyle_01234=2
QtrPivotsLineThickness=1
ShowQtrPivots=0
YesterdayHighLowColor=4802889
HighLowLineStyle_01234=2
HighLowSolidLineThickness=1
ShowYesterdayHighLow=1
TodayOpenColor=7405681
TodayOpenLineStyle_01234=2
TodayOpenSolidLineThickness=1
ShowTodayOpen=1
CamarillaColor=14053594
CamarillaLineStyle_01234=2
CamarillaSolidLineThickness=1
ShowCamarilla=0
PeriodSeparatorLinesColor=25186
SeparatorLinesStyle_01234=0
SeparatorLinesThickness=1
ShowPeriodSeparatorLines=1
PeriodSeparatorsLabelsColor=25186
PlaceAt_TopBot_12_OfChart=2
SeparatorLabelFontSize=9
S_Label_Norm_Bold_Black_123=2
ShowPeriodSeparatorLabels=1
PivotLinesLabelColor=25186
LineLabelsFontSize=9
L_Label_Norm_Bold_Black_123=1
LineLabelsIncludePrice=1
Relabeler_Adjustment=10
Show_Relabeler_Comment=0
Show_Data_Comment=0
var
//AMA optimized
period AMA=10
nfast=2.00000000
nslow=30.00000000
G=2.00000000
dK=2.00000000
PriceType=0
AMA_Trend_Type=1
var
//NonLagMA
Price=0
Length=55
Displace=0
PctFilter=0.00000000
Color=1
ColorBarBack=1
Deviation=0.00000000
SoundAlertMode=0
var
//#4X 3 Semafor Alert
Period1=5.00000000
Period2=12.00000000
Period3=35.00000000
Dev_Step_1=5,3
Dev_Step_2=5,3
Dev_Step_3=5,3
Symbol_1_Kod=159
Symbol_2_Kod=159
Symbol_3_Kod=82
_____=
Box.Alerts=0
Email.Alerts=0
Sound.Alerts=1
Alert.Lv1=0
Alert.Lv2=1
Alert.Lv3=1


//---------------------------------------------------------------------------
// Initialization
//---------------------------------------------------------------------------
procedure Init; stdcall;
begin
// define parameters
IndicatorShortName('THVSDXTZPivots');
SetOutputWindow(ow_ChartWindow);
extern int Local__HrsServerTzFromGMT = 0;
extern int Destination__HrsNewTZfromGMT = 0;
extern int Show_1Daily_2FibonacciPivots = 2;
extern bool FullScreenLines = FALSE;
extern bool __withMarginPrices = TRUE;
extern int MoveLabels_LR_DecrIncr = 0;
extern color R5_Color = FireBrick;
extern int R5_LineStyle_01234 = 2;
extern int R5_SolidLineThickness = 1;
extern color R4_Color = FireBrick;
extern int R4_LineStyle_01234 = 2;
extern int R4_SolidLineThickness = 1;
extern color R3_Color = FireBrick;
extern int R3_LineStyle_01234 = 2;
extern int R3_SolidLineThickness = 1;
extern color R2_Color = C'0x9B,0x1E,0x1E';
extern int R2_LineStyle_01234 = 2;
extern int R2_SolidLineThickness = 1;
extern color R1_Color = C'0x7D,0x17,0x17';
extern int R1_LineStyle_01234 = 2;
extern int R1_SolidLineThickness = 1;
extern color CentralPivotColor = C'0x00,0x62,0x62';
extern int CentralPivotLineStyle_01234 = 0;
extern int CentralPivotSolidLineThickness = 1;
extern color S1_Color = DarkGreen;
extern int S1_LineStyle_01234 = 2;
extern int S1_SolidLineThickness = 1;
extern color S2_Color = Green;
extern int S2_LineStyle_01234 = 2;
extern int S2_SolidLineThickness = 1;
extern color S3_Color = ForestGreen;
extern int S3_LineStyle_01234 = 2;
extern int S3_SolidLineThickness = 1;
extern color S4_Color = ForestGreen;
extern int S4_LineStyle_01234 = 2;
extern int S4_SolidLineThickness = 1;
extern color S5_Color = ForestGreen;
extern int S5_LineStyle_01234 = 2;
extern int S5_SolidLineThickness = 1;
extern color MidPivotsColor = C'0x62,0x62,0x00';
extern int MidPivotsLineStyle_01234 = 2;
extern int MidPivotsLineThickness = 1;
extern bool ShowMidPivots = TRUE;
extern color QtrPivotsColor = SaddleBrown;
extern int QtrPivotsLineStyle_01234 = 2;
extern int QtrPivotsLineThickness = 1;
extern bool ShowQtrPivots = FALSE;
extern color YesterdayHighLowColor = C'0x49,0x49,0x49';
extern int HighLowLineStyle_01234 = 2;
extern int HighLowSolidLineThickness = 1;
extern bool ShowYesterdayHighLow = TRUE;
extern color TodayOpenColor = C'0x71,0x00,0x71';
extern int TodayOpenLineStyle_01234 = 2;
extern int TodayOpenSolidLineThickness = 1;
extern bool ShowTodayOpen = TRUE;
extern color CamarillaColor = Orchid;
extern int CamarillaLineStyle_01234 = 2;
extern int CamarillaSolidLineThickness = 1;
extern bool ShowCamarilla = FALSE;
extern color PeriodSeparatorLinesColor = C'0x62,0x62,0x00';
extern int SeparatorLinesStyle_01234 = 0;
extern int SeparatorLinesThickness = 1;
extern bool ShowPeriodSeparatorLines = TRUE;
extern color PeriodSeparatorsLabelsColor = C'0x62,0x62,0x00';
extern int PlaceAt_TopBot_12_OfChart = 2;
extern int SeparatorLabelFontSize = 9;
extern int S_Label_Norm_Bold_Black_123 = 2;
extern bool ShowPeriodSeparatorLabels = TRUE;
extern color PivotLinesLabelColor = C'0x62,0x62,0x00';
extern int LineLabelsFontSize = 9;
extern int L_Label_Norm_Bold_Black_123 = 1;
extern bool LineLabelsIncludePrice = TRUE;
extern int Relabeler_Adjustment = 10;
extern bool Show_Relabeler_Comment = FALSE;
extern bool Show_Data_Comment = FALSE;
int gi_392;
int gi_396 = 0;
int gi_400 = 0;

procedure Init; stdcall;
begin
// define parameters
IndicatorShortName('AMA optimized');
SetOutputWindow(ow_ChartWindow);
extern int PriceType = 0;
extern int AMA_Trend_Type = 1;
double gda_120[];
double gda_124[];
double gda_128[];
double gda_132[];
double gda_136[];
double gda_140[];
double gda_144[];
bool gi_172 = FALSE;
// define parameters
IndicatorShortName('NonLagMA');
SetOutputWindow(ow_ChartWindow);
double gda_116[];
double gda_120[];
double gda_124[];
double gda_128[];
double gda_132[];
double gda_136[];
double gda_140[];
int gi_144;
int gi_148;
int gi_152;
int gi_156 = 4;
double gd_160;
double gd_168;
double gd_176;
double gd_192;
double gd_200;
double gd_208 = 3.1415926535;
bool gi_216 = FALSE;
bool gi_220 = FALSE;
// define parameters
IndicatorShortName('#4X 3 Semafor Alert');
SetOutputWindow(ow_ChartWindow);
string gs_168 = "stage one level high.wav";
string gs_176 = "stage one level low.wav";
string gs_184 = "stage two level high.wav";
string gs_192 = "stage two level low.wav";
string gs_200 = "stage three level high.wav";
string gs_208 = "stage three level low.wav";
double gda_216[];
double gda_220[];
double gda_224[];
double gda_228[];
double gda_232[];
double gda_236[];
int gi_240;
int gi_244;
int gi_248;
int gi_252;
int gi_256;
int gi_260;
int gi_264;
int gi_268;
int gi_272;
string gs_276;
string gs_284;
string gs_292;
int gi_300;
int gi_304;
int gi_320 = -1;
int gi_324 = 65535;
end;
// IndicatorBuffers(6);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, gda_116);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, gda_120);
SetIndexStyle(2, DRAW_LINE);
SetIndexBuffer(2, gda_124);
SetIndexBuffer(3, gda_128);
SetIndexBuffer(4, gda_132);
SetIndexBuffer(5, gda_136);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
string ls_0 = "MOACX NonLagMA (" + Length + ")";
IndicatorShortName(ls_0);
SetIndexLabel(0, "NonLagMA");
SetIndexLabel(1, "Up");
SetIndexLabel(2, "Dn");
SetIndexShift(0, Displace);
SetIndexShift(1, Displace);
SetIndexShift(2, Displace);
SetIndexEmptyValue(0, EMPTY_VALUE);
SetIndexEmptyValue(1, EMPTY_VALUE);
SetIndexEmptyValue(2, EMPTY_VALUE);
SetIndexDrawBegin(0, Length * gi_156 + Length + 1);
SetIndexDrawBegin(1, Length * gi_156 + Length + 1);
SetIndexDrawBegin(2, Length * gi_156 + Length + 1);
if (Period1 > 0.0)
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0, Symbol_1_Kod);
SetIndexBuffer(0, gda_216);
SetIndexEmptyValue(0, 0.0);
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1, Symbol_1_Kod);
SetIndexBuffer(1, gda_220);
SetIndexEmptyValue(1, 0.0);

if (Period2 > 0.0)
SetIndexStyle(2, DRAW_ARROW);
SetIndexArrow(2, Symbol_2_Kod);
SetIndexBuffer(2, gda_224);
SetIndexEmptyValue(2, 0.0);
SetIndexStyle(3, DRAW_ARROW);
SetIndexArrow(3, Symbol_2_Kod);
SetIndexBuffer(3, gda_228);
SetIndexEmptyValue(3, 0.0);

if (Period3 > 0.0)
SetIndexStyle(4, DRAW_ARROW);
SetIndexArrow(4, Symbol_3_Kod);
SetIndexBuffer(4, gda_232);
SetIndexEmptyValue(4, 0.0);
SetIndexStyle(5, DRAW_ARROW);
SetIndexArrow(5, Symbol_3_Kod);
SetIndexBuffer(5, gda_236);
SetIndexEmptyValue(5, 0.0);


IndicatorBuffers(11);

SetIndexBuffer(0, R3);
SetIndexStyle(0, ds_Line, psSolid, 1, clGreen);
SetIndexLabel(0, 'R3');

SetIndexBuffer(1, R2);
SetIndexStyle(1, ds_Line, psDashDot, 1, clBlue);
SetIndexLabel(1, 'R2');

SetIndexBuffer(2, R1);
SetIndexStyle(2, ds_Line, psDot, 1, clRed);
SetIndexLabel(2, 'R1');

SetIndexBuffer(3, PP);
SetIndexStyle(3, ds_Line, psDot, 1, clMaroon);
SetIndexLabel(3, 'PP');

SetIndexBuffer(4, S1);
SetIndexStyle(4, ds_Line, psDot, 1, clRed);
SetIndexLabel(4, 'S1');

SetIndexBuffer(5, S2);
SetIndexStyle(5, ds_Line, psDashDot, 1, clBlue);
SetIndexLabel(5, 'S2');

SetIndexBuffer(6, S3);
SetIndexStyle(6, ds_Line, psSolid, 1, clGreen);
SetIndexLabel(6, 'S3');

SetIndexBuffer(7, M1);
SetIndexStyle(7, ds_Line, psDot, 1, clGray);
SetIndexLabel(7, 'M1');

SetIndexBuffer(8, M2);
SetIndexStyle(8, ds_Line, psDot, 1, clGray);
SetIndexLabel(8, 'M2');

SetIndexBuffer(9, M3);
SetIndexStyle(9, ds_Line, psDot, 1, clGray);
SetIndexLabel(9, 'M3');

SetIndexBuffer(10, M4);
SetIndexStyle(10, ds_Line, psDot, 1, clGray);
SetIndexLabel(10, 'M4');
end;

//---------------------------------------------------------------------------
// Deinitialization
//---------------------------------------------------------------------------
procedure Done; stdcall;
begin
//
end;
// calculate THVSDXTZPivots
int init()
if (Ask > 10.0)
gi_392 = 2;
else gi_392 = 4;
Print("Period= ", Period());
return (0);

// calculate AMA optimized
double Price(int ai_0)
double ld_4;
switch (PriceType)
case 1:
ld_4 = Open[ai_0];
break;
case 2:
ld_4 = High[ai_0];
break;
case 3:
ld_4 = Low[ai_0];
break;
case 4:
ld_4 = (High[ai_0] + Low[ai_0]) / 2.0;
break;
case 5:
ld_4 = (High[ai_0] + Low[ai_0] + Close[ai_0]) / 3.0;
break;
case 6:
ld_4 = (High[ai_0] + Low[ai_0] + 2.0 * Close[ai_0]) / 4.0;
break;
default:
ld_4 = Close[ai_0];

return (ld_4);


// calculate NonLagMA
gd_160 = 3.0 * gd_208;
gi_148 = Length - 1;
gi_152 = Length * gi_156 + gi_148;
ArrayResize(gda_140, gi_152);
gd_192 = 0;
for (gi_144 = 0; gi_144 < gi_152 - 1; gi_144++)
if (gi_144 <= gi_148 - 1)
gd_176 = 1.0 * gi_144 / (gi_148 - 1);
else gd_176 = (gi_144 - gi_148 + 1) * (2.0 * gi_156 - 1.0) / (gi_156 * Length - 1.0) + 1.0;
gd_168 = MathCos(gd_208 * gd_176);
gd_200 = 1.0 / (gd_160 * gd_176 + 1.0);
if (gd_176 <= 0.5) gd_200 = 1;
gda_140[gi_144] = gd_200 * gd_168;
gd_192 += gda_140[gi_144];

return (0);
// calculate #4X 3 Semafor Alert

int li_0 = 0;
int li_4 = 0;
int li_12 = 0;
if (IntFromStr(Dev_Step_1, li_12, lia_8) == 1)
gi_256 = lia_8[1];
gi_252 = lia_8[0];

if (IntFromStr(Dev_Step_2, li_12, lia_8) == 1)
gi_264 = lia_8[1];
gi_260 = lia_8[0];

if (IntFromStr(Dev_Step_3, li_12, lia_8) == 1)
gi_272 = lia_8[1];
gi_268 = lia_8[0];

return (0);




end;
end;

exports

Init, Done, Calculate;

begin

end.

the problem is there are some eror says"Expected : but anditifier from line local till show 1 adily

and some symbol =, AMA, nFast, and Alert . only, please explain and how di i solve this?
Thank you
Back to top
View user's profile Send private message MSN Messenger
FT Support



Joined: 11 Jul 2009
Posts: 901

PostPosted: Tue Apr 26, 2011 3:28 pm    Post subject: Reply with quote

Hello, your code is totally wrong because you simply copied and pasted MQL code into Delphi.

for example in this code:
Code:
procedure Init; stdcall;
begin
// define parameters
IndicatorShortName('THVSDXTZPivots');
SetOutputWindow(ow_ChartWindow);
extern int Local__HrsServerTzFromGMT = 0;

line
Code:
extern int Local__HrsServerTzFromGMT = 0;


is not correct at all.

1) in Delphi there is no "extern" keyword, please use RegOption method instead

2) there is no "int" data type in Delphi, use "integer" instead

it should look like:

Code:

...
procedure Init; stdcall;
begin
// define parameters
IndicatorShortName('THVSDXTZPivots');
SetOutputWindow(ow_ChartWindow);
RegOption('put name of your variable here', ot_Integer, Local__HrsServerTzFromGMT);
Local__HrsServerTzFromGMT := 0;
...


please read our API description: Forex Tester -> Help -> Indicators API
also read more information about Delphi syntax over the internet.

_________________
Check our other products here:
www.fx-metropolis.com
www.forexcopier.com
Back to top
View user's profile Send private message Visit poster's website
hjabu



Joined: 21 Aug 2009
Posts: 30

PostPosted: Mon May 02, 2011 6:00 pm    Post subject: I dont have any idea eror"if" Reply with quote

I have created another code , and almost done but i have no idea, on eror
" IF ", Please anyone has answer how to resolve this, my code as shown below,:

//---------------------------------------------------------------------------
// THV SDX-TzPivots_v4.9
//---------------------------------------------------------------------------

library THVSDXTzPivots;

{ #property copyright "Copyright Shimodax"
#property link "http://www.strategybuilderfx.com" }

uses
SysUtils,
classes,
graphics,
math,
DateUtils,
IndicatorInterfaceUnit,
TechnicalFunctions in 'TechnicalFunctions.pas';


var
Local__HrsServerTzFromGMT: integer = 0;
Destination__HrsNewTZfromGMT: integer = 0;
Show_1Daily_2FibonacciPivots: integer = 2;
FullScreenLines: boolean = FALSE;
__withMarginPrices: boolean = TRUE;
MoveLabels_LR_DecrIncr: integer = 0;
Relabeler_Adjustment: integer = 10;
Show_Relabeler_Comment: boolean = FALSE;
Show_Data_Comment: boolean = FALSE;
//---------------------------------------------------------------------------
// Initialization
//---------------------------------------------------------------------------
procedure Init; stdcall;
begin
// define parameters
IndicatorShortName('THVSDXTzPivots');
SetOutputWindow(ow_ChartWindow);

RegOption('Pivot Type', ot_EnumType, PivotType);
AddOptionValue('Pivot Type', 'Daily');

RegOption('YesterdayHighLowColor',ot_EnumType,yesterdayHighColor);
AddOptionValue('HighLowLineType','HighLowLineStyle_01234');
AddOptionValue('HighLowSolidLineType','HighLowSolidLineThickness');
AddOtionValue('ShowYesterdayType','ShowYesterdayHighLow');

RegOption('TodayOpenColor',ot_EnumType,TodayOpenColor);
AddOptionValue('TodayOpenLineType','OpenLineStyle_01234');
AddOptionValue('TodayOpenType','TodayOpenSolidLineThickness');
AddOptionValue('ShowTodayType','ShowTodayOpen');

RegOption('CamarillaColor',ot_EnumType,CamarillaColor);
AddOptionValue('CamarillaLineType','CamarillaLineStyle_01234');
AddOptionValue('CamarillaSolidLineType','CamarillaSolidLineThickness');
AddOptionValue('ShowCamarillaType','ShowCamarilla');

RegOption('PeriodSeparatorLinesColor',ot_EnumType,PeriodSeparatorLinesColor);
AddOptionValue('SeparatorLinesType','SeparatorLinesStyle_01234');
AddOptionValue('SeparatorLinesType','SeparatorLinesThickness');
AddOptionValue('ShowPeriodType','ShowPeriodSeparatorLines');

RegOption('PeriodSeparatorsLabelsColor',ot_EnumType,PeriodSeparatorsLabelsColor);
AddOptionValue('PlaceAtType','PlaceAt_TopBot_12_OfChart');
AddOptionValue('SeparatorLabelType','SeparatorLabelFontSize');
AddOptionValue('_Label_Norm_Type','_Label_Norm_Bold_Black_123');
AddOptionValue('ShowPeriodType','ShowPeriodSeparatorLabels');

RegOption('PivotLinesLabelColor',ot_EnumType,PivotLinesLabelColor);
AddOptionValue('LineLabelsType','LineLabelsFontSize');
AddOptionValue('L_Label_Type','L_Label_Norm_Bold_Black_123T');
AddOptionValue('LineLabelsType','LineLabelsIncludePrice');

// create index buffers
MidPivot := CreateIndexBuffer;
QtrPivot := CreateIndexBuffer;
R1 := CreateIndexBuffer;
R2 := CreateIndexBuffer;
R3 := CreateIndexBuffer;
R4 := CreateIndexBuffer;
R5 := CreateIndexBuffer;
S1 := CreateIndexBuffer;
S2 := CreateIndexBuffer;
S3 := CreateIndexBuffer;
S4 := CreateIndexBuffer;
S5 := CreateIndexBuffer;
CentralPivot := CreateIndexBuffer;
YesterdayHighLowColor := CreateIndexBuffer;
TodayOpenColor := CreateIndexBuffer;
Camarilla := CreateIndexBuffer;
PeriodSeparatorLines := CreateIndexBuffer;
PivotLinesLabel := CreateIndexBuffer;


IndicatorBuffers(1Cool;

SetIndexBuffer(0, R5);
SetIndexStyle(0, ds_Line, psSolid, 1, clFireBrick);
SetIndexLabel(0, 'R5');

SetIndexBuffer(0, R4);
SetIndexStyle(0, ds_Line, psSolid, 1, clFireBrick);
SetIndexLabel(0, 'R4');

SetIndexBuffer(0, R3);
SetIndexStyle(0, ds_Line, psSolid, 1, clFireBrick);
SetIndexLabel(0, 'R3');

SetIndexBuffer(0, R2);
SetIndexStyle(0, ds_Line, psSolid, 1, clFireBrick);
SetIndexLabel(0, 'R2');

SetIndexBuffer(0, R1);
SetIndexStyle(0, ds_Line, psSolid, 1, clFireBrick);
SetIndexLabel(0, 'R1');

SetIndexBuffer(0, CentralPivot);
SetIndexStyle(0, ds_Line, psSolid, 1, clC0x00_0x62_0x62);
SetIndexLabel(0, 'CentralPivot');

SetIndexBuffer(0, MidPivot);
SetIndexStyle(0, ds_Line, psSolid, 1, clC0x62_0X62_0X00);
SetIndexLabel(0, 'MidPivot');

SetIndexBuffer(0, QtrP);
SetIndexStyle(0, ds_Line, psSolid, 1, clC0x62_0X62_0X00);
SetIndexLabel(0, 'QtrP')

SetIndexBuffer(0, S1);
SetIndexStyle(0, ds_Line, psSolid, 1, clDarkGreen);
SetIndexLabel(0, 'S1');

SetIndexBuffer(0, S2);
SetIndexStyle(0, ds_Line, psSolid, 1, clGreen);
SetIndexLabel(0, 'S2');

SetIndexBuffer(0, S3);
SetIndexStyle(0, ds_Line, psSolid, 1, clForestGreen);
SetIndexLabel(0, 'S3');

SetIndexBuffer(0, S4);
SetIndexStyle(0, ds_Line, psSolid, 1, clForestGreen);
SetIndexLabel(0, 'S4');

SetIndexBuffer(0, S5);
SetIndexStyle(0, ds_Line, psSolid, 1, clForestGreen);
SetIndexLabel(0, 'S5');

SetIndexBuffer(0, CentralPivot);
SetIndexStyle(0, ds_Line, psSolid, 1, clC0x00_0x62_0x62);
SetIndexLabel(0, 'CentralPivot');

SetIndexBuffer(0, YesterdayHighLow);
SetIndexStyle(0, ds_Line, psSolid, 1, clC0x49_0x49_0x49);
SetIndexLabel(0, 'YesterdayHighLow');

SetIndexBuffer(0, TodayOpen);
SetIndexStyle(0, ds_Line, psSolid, 1, clC0x71_0x00_0x71);
SetIndexLabel(0, 'TodayOpen');

SetIndexBuffer(0, Camarilla);
SetIndexStyle(0, ds_Line, psSolid, 1, clOrchid);
SetIndexLabel(0, 'Camarilla');

SetIndexBuffer(0, PeriodSeparatorLines);
SetIndexStyle(0, ds_Line, psSolid, 1, clC0x62_0x62_0x00);
SetIndexLabel(0, 'PeriodSeparatorLines');


SetIndexBuffer(0, PivotLinesLabel);
SetIndexStyle(0, ds_Line, psSolid, 1, clC0x62_0x62_0x00);
SetIndexLabel(0, 'PivotLinesLabel');
end;

//---------------------------------------------------------------------------
// Deinitialization
//---------------------------------------------------------------------------
procedure Done; stdcall;
begin
//
end;

//---------------------------------------------------------------------------
// Calculate bar
//---------------------------------------------------------------------------
procedure Calculate(index: integer); stdcall;
var

integer: gi_392;
integer: gi_396 = 0;
integer: gi_400 = 0;


integer: init()
if (Ask > 10.0) EROR on EXPECTED on "IF " words
gi_392 = 2;
integer: gi_392 = 4;
Print("Period= ", Period());

exports

Init, Done, Calculate;

begin

end.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> Programming lessons All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group