以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  ifflogic 和 lastbaronChart怎么实现  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=69796)

--  作者:optimus
--  发布时间:2014/9/10 14:23:27
--  ifflogic 和 lastbaronChart怎么实现
请问 金字塔里怎么实现和 easylanguage里相似功能:

1. ifflogic函数(以下是easylanguage的解释):

The IFFLogic function is used to conditionally return one of two specified true/false expressions.

Syntax

IFFLogic(Test, TrueVal, FalseVal)

Returns (Boolean)

The true/false value of TrueVal if Test is true; the true/false value of FalseVal if Test is false.

Parameters

Name

Type

Expression

Test

TrueFalse

Specifies the conditional expression to check (such as CloseOpen).

TrueVal

TrueFalse

Sets the True/False expression to evaluate if Test condition is true.

FalseVal

TrueFalse

Sets the True/False expression to evaluate if Test condition is false.

Remarks

The IFFLogic function enables you use a Test condition to determine whether to evaluate either a \'True\' expression or \'False\' expression.

This function is similar to the IFF function, however the second and third inputs are true/false expressions, not numeric values.

Example

Assigns to Value1 the true/false value of the expression Close>Close[1] if Close>Open is true or the true/false value of the expression Open<Open[1] if Close>Open is false.

Value1 = IFFLogic(Close>OpenClose>Close[1], Open<Open[1]);

Reference

The IFFLogic function was developed by TradeStation Technologies, Inc.



2. LastBarOnChart(以下是easylanguage的解释):

The LastBarOnChart function is used to determine if the current bar being evaluated is the last bar on the chart.

Syntax

LastBarOnChart

Returns (Boolean)

True if LastBarOnChart is the last charted bar. False if not.

Parameters

None

Example

In order to play a wave (sound) file only in the last bar of the chart you can write:

If LastBarOnChart Then
 Condition1 = PlaySound("C:\\window\\ding.wav");

note_icon.png   This function will return True for all bars on a chart with tick-based interval, which have the same date and time as the last bar of the chart.





--  作者:jinzhe
--  发布时间:2014/9/10 14:41:11
--  
讲中文
--  作者:optimus
--  发布时间:2014/9/10 14:48:08
--  回复:(jinzhe)讲中文
好吧,意思是这个样子的:

1. ifflogic(easylanguage里):

这个函数用法是:变量A=ifflogic(判断条件,逻辑表达式1,逻辑表达式2)

当判断条件为真时,执行逻辑表达式1,该表达式的值可能为true或false,把这个结果赋给变量A,

当判断条件为假时,执行逻辑表达式2,该表达式的值可能为true或false,把这个结果赋给变量A

我想问在金字塔里该怎么实现这个函数的功能?

2. LastBarOnChart:

这个是easylanguage里内建的一个变量。

如果当前读到的Bar是图形上的最后一个Bar,LastBarOnChart的值就是true

如果当前读到的Bar不是图形上的最后一个Bar,LastBarOnChart的值就是false

我想问这个变量在金字塔里可有对应的功能来实现?

--  作者:jinzhe
--  发布时间:2014/9/10 14:49:31
--  

1.if

2.islastbar


--  作者:optimus
--  发布时间:2014/9/10 14:58:34
--  回复:(jinzhe)1.if2.islastbar
好的,谢谢。