Pointer and Records

Posted By Jeremia Friday, July 30, 2010
Add to Favorites0
Author Message
Jeremia
 Posted Friday, July 30, 2010
Junior Member

Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)

Group: Forum Members
Last Active: Saturday, October 16, 2010
Posts: 7, Visits: 29
11
Hi,

i want to use a record to combine some values in a nice data structure.
As i've seen the editor is aware of the keyword "record" but I wasn't able to create a record.
I have tried the common ways which are known in Delphi an Pascal.


How can I write a Function which takes a Pointer as argument?
I have seen, that the AddCandleHistorySetting function takes pointer as arguments but how is the
right code to build an own function like that?

Best regards

Jeremia
eMoe
 Posted Monday, August 09, 2010
Supreme Being

Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)

Group: Forum Members
Last Active: 2 days ago @ 2:45 AM
Posts: 201, Visits: 299
619
Hi, Jeremia!
What do you mean in “pointer as arguments”?
AddCandleHistorySetting used that settings what have been written in

procedure OnCreate;
begin
AddFloatSetting(@FS, 'Float Setting', 1.45);
AddIntegerSetting(@IntS, 'Integer Setting', 45);
AddStringSetting(@SS, 'String Setting', 'a123');
end;

What function exactly do you want to write?


Best regards!
Jeremia
 Posted Monday, August 16, 2010
Junior Member

Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)Junior Member - (11 reputation)

Group: Forum Members
Last Active: Saturday, October 16, 2010
Posts: 7, Visits: 29
11
Hi eMoe,

as far as I know from the Pascal programming language the '@' means that the parameter is given to the function as pointer instead of making a copy of it.
This is much more eficient than copying the variable as value over the stack. In addition it gives the possibility to change the value of the parameter inside the function.

With this you can for example write functions which return more than one value.


procedure GetMinMax(var graph: TChartGraph; range:Integer; minBigGrinouble; maxBigGrinouble);

In this procedure the minimum and maximum values from a given graph in a given range are determined. The result is written in the variables min and max. For this you need the possibility to use pointer as parameters.

Best regards

Jeremia
eMoe
 Posted Thursday, September 30, 2010
Supreme Being

Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)Supreme Being - (619 reputation)

Group: Forum Members
Last Active: 2 days ago @ 2:45 AM
Posts: 201, Visits: 299
619
Hi, Jeremia!


// This function will get maximum rate for defined number of candles(count) from Index (first candle).
function maxCandle(count,Index : integer): double;
var
m : double;
i : integer;
begin
m:=History.Last(Index).High;
for i := 1 to count-1 do
m := max(m,History.Last(Index+i).High);
result := m;
end;

----------------------------------------------------------------------------------------------------------------------

// This function will get minimal rate for defined number of candles(count) from Index (first candle).

function minCandle(count,Index : integer): double;
var
m : double;
i : integer;
begin
m:=History.Last(Index).Low;
for i := 1 to count-1 do
m := min(m,History.Last(Index+i).Low);
result := m;
end;


Best regards!
Thursday, September 30, 2010 by eMoe

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top