SetGvarIf(d,n,c,NDLEP)
Previous Topic  Next Topic 


Name

Comment

Name

Description


Parameter 1

Parameter 2

Parameter 3

Parameter 4








Returns


Comment


Example

Set Global Variable If

Set a global value that is not connected to a specific paper. The value is stored the next time you restart the program, and any script can read the value. 900 variables 0-899 are available. 'If' forms the condition when to write the value.

Value to set in variable, a float number. (use decimal point)

Memory cell 0-899

Depending on parameter 4. Connects a "write condition"

T=True, ie the value in parameter 1 is set if parameter 3 is true, and it is time stamped according to the  computer clock at the momtent. D=Date, ie parameter 3 is expected to be a date/time stamp to attach  to the writing.

L=Later, ie writing is done if the attached time stamp in parameter 3 is later than the time stamp from the previous writing.

E=Earlier, ie writing is done if the attached time stamp in parameter 3 is earlier than the time stamp from the previous writing.

P=Previous, ie the variable can act as two variabls with current value and old value stored in time stamp cell and can be loaded with GetGvar(d,P).


Same as indataseries to be able to be used transparently within scripts. No operation on data.



Scripts connected to several papers can exchange information with each other using global cells.

SetGVarIf(c,155,1) always write Close-price to cell 155, as parameter 3 is true and time stamped  according to the computer clock right now. SetGVarIf(c,155,gt(c,ref(h,1))) writes close only if close  is higher than close the previous period.

SetGvarIf(c,155,d,d) writes close to cell 155, and the current bar as the time stamp. 

SetGVarIf(c,155,D,L) writes if the current period time is later than the previous written. This is useful to isolate effects from the script running to draw a chart.

SetGVarIf(c,155,gt(c,ref(c,1)),P) writes close to cell if higher than last periods close. Cell 155 gets Close now, and the old value is moved to the date cell that can later be fetched using GetGVar(d,P).