powerlanguage keyword reference - multicharts · magenta margin market marketposition...

Post on 22-Aug-2020

24 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

PowerLanguage Keyword Reference

KeywordAlphabeticalIndex

A-DE-NO-ST-Z

#BeginCmtry#Events#ReturnAAbortAboveAbsValueAgoAlertAlertEnabledAllAllowSendOrdersAlwaysAnAndArcTangentArrayArray_CompareArray_ContainsArray_CopyArray_GetBooleanValueArray_GetFloatValueArray_GetIntegerValueArray_GetMaxIndexArray_GetStringValueArray_GetTypeArray_IndexOfArray_SetBooleanValueArray_SetFloatValueArray_SetIntegerValue

2

Array_SetMaxIndexArray_SetStringValueArray_SetValRangeArray_SortArray_SumArraysArraySizeArrayStartAddrArw_Anchor_to_BarsArw_DeleteArw_Get_Anchor_to_BarsArw_GetActiveArw_GetBarNumberArw_GetColorArw_GetDateArw_GetDirectionArw_GetFirstArw_GetLockArw_GetNextArw_GetSizeArw_GetStyleArw_GetTextArw_GetTextAttributeArw_GetTextBGColorArw_GetTextColorArw_GetTextFontNameArw_GetTextSizeArw_GetTimeArw_GetTime_DTArw_GetTime_sArw_GetValArw_LockArw_NewArw_New_BNArw_New_DT

3

Arw_New_sArw_New_selfARW_New_Self_BNArw_New_Self_DTArw_New_self_sArw_SetBarNumberArw_SetColorArw_SetLocationArw_SetLocation_BNArw_SetLocation_DTArw_SetLocation_sArw_SetSizeArw_SetStyleArw_SetTextArw_SetTextAttributeArw_SetTextBGColorArw_SetTextColorArw_SetTextFontNameArw_SetTextSizeAskSizeAtAtCommentaryBarAUDAutoSessionAvgBarsEvenTradeAvgBarsLosTradeAvgBarsWinTradeAvgEntryPriceAvgEntryPrice_at_BrokerAvgEntryPrice_at_Broker_for_The_StrategyAvgListBarBarIntervalBars

4

BarsSinceEntryBarsSinceEntry_CheckedBarsSinceExitBarsSinceExit_CheckedBarStatusBarTypeBarType_exBasedBaseDataNumberBeginBelowBidSizeBigPointValueBlackBlueBoolBoxSizeBreakBuyBuyToCoverByByteCCADCallCancelAlertcaseCategoryCeilingChangeMarketPositionCharCheckAlertCheckCommentaryCHFClearDebug

5

ClearPrintLog

CloseCommandLineCommentaryCommentaryCLCommentaryEnabledCommissionComputerDateTimeContractContractProfitContractsConvert_CurrencyCosineCotangentCoverCrossCrossesCurrentBarCurrentContractsCurrentDataNumberCurrentDateCurrentEntriesCurrentOpenIntCurrentSharesCurrentTimeCurrentTime_sCyanDDailyCloseDailyHighDailyLimitDailyLowDailyOpenDailyVolume

6

DarkBlueDarkBrown

DarkCyanDarkGrayDarkGreenDarkMagentaDarkRedDarkYellowDataDataCompressionDateDateTimeDatetime_bar_updateDateTime2ELTimeDateTime2ELTime_sDateTimeToStringDateTimeToString_MsDateToJulianDateToStringDayDayFromDateTimeDayOfMonthDayOfWeekDayOfWeekFromDateTimeDaysDefaultDefineDLLFuncDescriptionDoesDOM_AskPriceDOM_AsksCountDOM_AskSizeDOM_BidPriceDOM_BidsCount

7

DOM_BidSizeDOM_IsConnectedDouble

DoubleQuoteDownTicksDownToDWORD

8

KeywordAlphabeticalIndex

A-DE-NO-ST-Z

El_DateStrEl_DateToDateTimeEL_TimeToDateTimeEL_TimeToDateTime_sELDateToDateTimeElseELTimeToDateTimeELTimeToDateTime_sEncodeDateEncodeTimeEndEntryEntryDateEntryDate_CheckedEntryDateTimeEntryDateTime_CheckedEntryNameEntryPriceEntryPrice_CheckedEntryTimeEntryTime_CheckedEURExchListedExecOffsetExitDateExitDate_CheckedExitDateTimeExitDateTime_CheckedExitName

9

ExitPriceExitPrice_CheckedExitTimeExitTime_CheckedExpirationDateExpirationDateFromVendorExpValueExternalFalseFileFileAppendFileDeleteFill_ArrayFloatFloorForFormatDateFormatTimefpcExactAccuracyfpcHighAccuracyfpcLowAccuracyfpcMedAccuracyfpcVeryHighAccuracyfpcVeryLowAccuracyFracPortionFridayFromGBPGetAccountGetAccountIDGetAppInfoGetBackgroundColorGetBValueGetCDRomDriveGetCountry

10

GetCurrencyGetExchangeNameGetGValueGetNumAccountsGetNumPositionsGetPlotBGColorGetPlotColorGetPlotWidthGetPositionAveragePriceGetPositionOpenPLGetPositionQuantityGetPositionSymbolGetPositionTotalCostGetRTAccountEquityGetRTAccountNetWorthGetRTSymbolNameGetRTUnrealizedPLGetRValueGetStrategyNameGetSymbolNameGetUserIDGetUserNameGradientColorGreenGrossLossGrossProfitHHighHigherHKDHoursFromDateTimeIi_AvgEntryPricei_AvgEntryPrice_at_Broker

11

i_AvgEntryPrice_at_Broker_for_The_Strategyi_ClosedEquityi_CurrentContractsi_CurrentSharesI_getplotvaluei_MarketPositioni_MarketPosition_at_Brokeri_MarketPosition_at_Broker_for_The_Strategyi_OpenEquityI_setplotvalueiEasyLanguageObjectIfIncMonthInitialCapitalInputInputsInsideAskInsideBidInStrIntInt64IntervalTypeIntervalType_exIntPortionIntraBarOrderGenerationIntraBarPersistIsJPYJulianToDateLLargestLosTradeLargestWinTradeLastLastCalcDateTimeLastCalcJDate

12

LastCalcMMTime

LastCalcmSTimeLastCalcSSTimeLeftStrLegacyColorToRGBLegacyColorValueLightGrayLimitLogLongLowLowerLowerStrLPBoolLPByteLPDoubleLPDWORDLPFloatLPIntLPLongLPSTRLPWORDMagentaMarginMarketMarketPositionMarketPosition_at_BrokerMarketPosition_at_Broker_for_The_StrategyMarketPosition_CheckedMaxBarsBackMaxBarsForwardMaxConsecLosersMaxConsecWinnersMaxContractProfit

13

MaxContractProfit_CheckedMaxContracts

MaxContracts_CheckedMaxContractsHeldMaxEntriesMaxEntries_CheckedMaxIDDrawDownMaxListMaxList2MaxPositionLossMaxPositionLoss_CheckedMaxPositionProfitMaxPositionProfit_CheckedMaxPositionsAgoMaxSharesMaxShares_CheckedMaxSharesHeldMC_Arw_GetActiveMC_Text_GetActiveMC_TL_GetActiveMC_TL_NewMC_TL_New_BNMC_TL_New_DTMC_TL_New_SelfMC_TL_New_Self_BNMC_TL_New_Self_DTMessageLogMethodMidStrMillisecondsFromDateTimeMinListMinList2MinMoveMinutesFromDateTime

14

ModMondayMonth

MonthFromDateTimeMouseClickBarNumberMouseClickCtrlPressedMouseClickDataNumberMouseClickDateTimeMouseClickPriceMouseClickShiftPressedNegNetProfitNewLineNextNOKNoneNoPlotNotNthMaxListNthMinListNumericNumericArrayNumericArrayRefNumericRefNumericSeriesNumericSimpleNumEvenTradesNumLosTradesNumToStrNumWinTradesNZD

15

KeywordAlphabeticalIndex

A-DE-NO-ST-Z

OOfOnOnCreateOnDestroyOpenOpenEntriesCountOpenEntryComissionOpenEntryContractsOpenEntryDateOpenEntryMaxProfitOpenEntryMaxProfitPerContractOpenEntryMinProfitOpenEntryMinProfitPerContractOpenEntryPriceOpenEntryProfitOpenEntryProfitPerContractOpenEntryTimeOpenIntOpenPositionProfitOptionTypeOrOverPercentProfitPlacePlaceMarketOrderPlaySoundPlotPlotPaintBar

16

PlotPBpmm_get_global_named_numpmm_get_global_named_strpmm_get_my_named_numpmm_get_my_named_strpmm_set_global_named_numpmm_set_global_named_strpmm_set_my_named_numpmm_set_my_named_strpmm_set_my_statuspmms_get_strategy_named_numpmms_get_strategy_named_strpmms_set_strategy_named_numpmms_set_strategy_named_strpmms_strategies_allow_entries_allpmms_strategies_countpmms_strategies_deny_entries_allpmms_strategies_get_by_symbol_namepmms_strategies_in_long_countpmms_strategies_in_positions_countpmms_strategies_in_short_countpmms_strategies_pause_allpmms_strategies_resume_allpmms_strategies_set_status_for_allpmms_strategy_allow_entriespmms_strategy_allow_exit_from_longpmms_strategy_allow_exit_from_shortpmms_strategy_allow_exitspmms_strategy_allow_long_entriespmms_strategy_allow_short_entriespmms_strategy_close_positionpmms_strategy_currentcontractspmms_strategy_deny_entriespmms_strategy_deny_exit_from_longpmms_strategy_deny_exit_from_short

17

pmms_strategy_deny_exitspmms_strategy_deny_long_entriespmms_strategy_deny_short_entriespmms_strategy_entrypricepmms_strategy_get_entry_contractspmms_strategy_is_pausedpmms_strategy_marketpositionpmms_strategy_maxiddrawdownpmms_strategy_netprofitpmms_strategy_openprofitpmms_strategy_pausepmms_strategy_resumepmms_strategy_riskcapitalpmms_strategy_set_entry_contractspmms_strategy_set_statuspmms_strategy_symbolPointPointsPointValuePortfolio_CalcMaxPotentialLossForEntryPortfolio_CurrencyCodePortfolio_CurrentEntriesPortfolio_GetMarginPerContractPortfolio_GetMaxPotentialLossPerContractPortfolio_GrossLossPortfolio_GrossProfitPortfolio_InvestedCapitalPortfolio_MaxIDDrawdownPortfolio_MaxOpenPositionPotentialLossPortfolio_MaxRiskEquityPerPosPercentPortfolio_NetProfitPortfolio_NumLossTradesPortfolio_NumWinTradesPortfolio_OpenPositionProfit

18

Portfolio_PercentProfitPortfolio_SetMaxPotentialLossPerContractPortfolio_StrategyDrawdownPortfolio_TotalMaxRiskEquityPercentPortfolio_TotalTradesPortfolioEntriesPriorityPosPositionProfitPositionProfit_CheckedPosTradeCommissionPosTradeCountPosTradeEntryBarPosTradeEntryCategoryPosTradeEntryDateTimePosTradeEntryNamePosTradeEntryPricePosTradeExitBarPosTradeExitCategoryPosTradeExitDateTimePosTradeExitNamePosTradeExitPricePosTradeIsLongPosTradeIsOpenPosTradeProfitPosTradeSizePowerPrevClosePriceScalePrintProcessMouseEventsPutq_Askq_asksizeq_Bidq_bidsize

19

q_BigPointValue

q_Dateq_ExchangeListedq_Lastq_OpenInterestq_PreviousCloseq_Timeq_Time_Dtq_Time_sq_TotalVolumeq_tradevolumeRaiseRunTimeErrorRandomRecalcLastBarAfterRecalcPersistReCalculateRedRegularSessionRevSizeRGBRGBToLegacyColorRightStrRoundRTSymbolRTSymbolNameSameExitFromOneEntryOnceSaturdayScrollToBarSecondsFromDateTimeSEKSelfSellSellShortSess1EndTime

20

Sess1FirstBarTimeSess1StartTime

Sess2EndTimeSess2FirstBarTimeSess2StartTimeSessionCountSessionCountMSSessionEndDaySessionEndDayMSSessionEndTimeSessionEndTimeMSSessionLastBarSessionStartDaySessionStartDayMSSessionStartTimeSessionStartTimeMSSetBreakEvenSetBreakEven_ptSetCustomFitnessValueSetDollarTrailingSetExitOnCloseSetFPCompareAccuracySetMaxBarsBackSetPercentTrailingSetPercentTrailing_ptSetPlotBGColorSetPlotColorSetPlotWidthSetProfitTargetSetProfitTarget_ptSetStopContractSetStopLossSetStopLoss_ptSetStopPosition

21

SetStopShareSetTrailingStop_ptSGD

ShareSharesShortSignSineSlippageSpacesSquareSquareRootStopStrikeStringStringArrayStringArrayRefStringRefStringSeriesStringSimpleStringToDateStringToDateTimeStringToDTFormattedStringToTimeStrLenStrToNumSumListSundayswitchSymbolSymbol_CloseSymbol_CurrentBarSymbol_DateSymbol_DownTicks

22

Symbol_HighSymbol_LengthSymbol_LowSymbol_Open

Symbol_OpenIntSymbol_TickIDSymbol_TicksSymbol_TimeSymbol_Time_SSymbol_UpTicksSymbol_VolumeSymbolCurrencyCodeSymbolName

23

KeywordAlphabeticalIndex

A-DE-NO-ST-Z

TTangentTextText_Anchor_to_BarsText_DeleteText_Get_Anchor_to_BarsText_GetActiveText_GetAttributeText_GetBarNumberText_GetBGColorText_GetBorderText_GetColorText_GetDateText_GetFirstText_GetFontNameText_GetHStyleText_GetLockText_GetNextText_GetSizeText_GetStringText_GetTimeText_GetTime_DTText_GetTime_sText_GetValueText_GetVStyleText_LockText_NewText_New_BNText_New_Dt

24

Text_New_sText_New_selfText_New_Self_BNText_New_Self_DTText_New_self_sText_SetAttributeText_SetBarNumberText_SetBGColorText_SetBorderText_SetColorText_SetFontNameText_SetLocationText_SetLocation_BNText_SetLocation_DTText_SetLocation_sText_SetSizeText_SetStringText_SetStyleThanTheThenThisThreadSafeThursdayTickIDTicksTimeTime_sTime_s2TimeTime2Time_sTimeToStringTL_Anchor_to_BarsTL_DeleteTL_Get_Anchor_to_BarsTL_GetActive

25

TL_GetAlertTL_GetBegin_BNTL_GetBegin_DtTL_GetBeginDateTL_GetBeginTimeTL_GetBeginTime_sTL_GetBeginValTL_GetColorTL_GetEnd_BNTL_GetEnd_DtTL_GetEndDateTL_GetEndTimeTL_GetEndTime_sTL_GetEndValTL_GetExtLeftTL_GetExtRightTL_GetFirstTL_GetLockTL_GetNextTL_GetSizeTL_GetStyleTL_GetValueTL_GetValue_BNTL_GetValue_DtTL_GetValue_sTL_LockTL_NewTL_New_BNTL_New_DtTL_New_sTL_New_selfTL_New_Self_BNTL_New_Self_DtTL_New_Self_s

26

TL_SetAlertTL_SetBeginTL_SetBegin_BNTL_SetBegin_DTTL_SetBegin_sTL_SetColorTL_SetEndTL_SetEnd_BNTL_SetEnd_DtTL_SetEnd_sTL_SetExtLeftTL_SetExtRightTL_SetSizeTL_SetStyleToTodayTool_DashedTool_Dashed2Tool_Dashed3Tool_DottedTool_SolidTotalTotalBarsEvenTradesTotalBarsLosTradesTotalBarsWinTradesTotalTradesTradeDateTradeTimeTradeVolumeTrueTrueFalseTrueFalseArrayTrueFalseArrayRefTrueFalseRefTrueFalseSeries

27

TrueFalseSimple

TRY_TuesdayUnderUnsignedUpperStrUpTicksUSDVVarVariableVariablesVarsVarSizeVarStartAddrVoidVolumeWasWednesdayWhileWhiteWORDYearYearFromDateTimeYellowYesterdayZAR

28

GetAccount

Returnstheaccountnumberfortheaccountataspecificlocationinthelistofaccounts.

IfthevaluereturnedbyGetNumAccountsisanon-zero,then:

for1<=AccountLoc<=GetNumAccounts,thefunctionreturnstheaccountnumber.

Forothersequencenumbersanemptystring("")isreturned.

Usage

GetAccount(AccountLoc)

Where:AccountLoc-thesequencenumberoftheaccountinthelistofaccounts.

Notes

ThisfunctioncanbeusedalongwithGetNumAccounts,toenumerateavailableaccountsreturnedbybroker.

Example

Thebrokerreturnedthefollowinglistofaccounts:"DU12345","DU23456","DU34567","DU45678".

GetAccount(3)willreturn"DU34567".

GetAccount(5)willreturn"".

29

GetAccountID

Returnstheaccountnumberwhichisusedforautotradingonthechart,wherethestrategyisapplied.

Usage

GetAccountID()

Example

GetAccountID()willreturn"DU34567"iftheaccountnumberwhichisusedforautotradingonthechart,wherethestrategyisapplied,isDU12345.

30

GetNumAccounts

Returnsthenumberofaccountsinthelistofaccountsobtainedfrombroker.

Ifthelistisempty,an"N/A"value,i.e.0,isreturned.

Usage

GetNumAccounts

Example

Thebrokerreturnedthefollowinglistofaccounts:"DU12345","DU23456","DU34567","DU45678".GetNumAccountswillreturnavalueof4.

31

GetNumPositions

ReturnsthenumberofpositionsinMultiChartsOrderandPositionTracker(nottheactualamountatthebroker).

Usage

GetNumPositions(Account)

Where:Account-accountnumberatbroker.

Example

GetNumPositions("DU12345")willreturnavalueof3ifthetotalnumberofopenpositionsinMultiChartsOrderandPositionTrackeris3.

32

GetPositionAveragePrice

Returnsaveragepriceoftheposition.

Usage

GetPositionAveragePrice(Symbol,Account)

Where:Symbol-thenameoftheinstrument.Account-accountnumberatbroker.

Example

Willreturnavalueof1.3456iftheaverageentrypricefortheposition,definedbyspecifiedaccount/symbolpairis1.3456.

33

GetPositionOpenPL

ReturnsOpenPLvaluein:

SymbolcurrencyforAvanza(calculatedonMultiChartsside)AccountcurrencyforAvaTrade(calculatedonthebroker'sside)SymbolcurrencyforCQG(calculatedonthebroker'sside)SymbolcurrencyforDukascopy(calculatedonMultiChartsside)AccountcurrencyforFXCM(calculatedonthebroker'sside)SymbolcurrencyforInteractiveBrokers(calculatedonMultiChartsside)SymbolcurrencyforLMAX(calculatedonthebroker'sside)SymbolcurrencyforMBTrading(calculatedonMultiChartsside)SymbolcurrencyforOpenECry(calculatedonthebroker'sside)SymbolcurrencyforPatsystems(calculatedonthebroker'sside)SymbolcurrencyforTradingTechnologies(calculatedonMultiChartsside)SymbolcurrencyforWeBank(calculatedonMultiChartsside)SymbolcurrencyforRithmic(calculatedonthebroker'sside)

Usage

GetPositionOpenPL(Symbol,Account)

Where:Symbol-thenameoftheinstrument.Account-accountnumberatbroker.

Example

Willreturn15ifthecurrentvaluein"OpenPL"columnin"OrderandPositionTracker"windowfortheaccountis15unitsoftheselectedcurrency.

34

GetPositionQuantity

Returnsthesizeoftheposition,definedbyspecifiedaccount/symbolpair.

Usage

GetPositionQuantity(Symbol,Account)

Where:Symbol-thenameoftheinstrument.Account-accountnumberatbroker.

Example

GetPositionQuantity("ESZ1","DU12345")willreturnavalueof1000ifthesizeoftheposition,definedbyspecifiedaccount/symbolpairpositionis¤1000.

35

GetPositionSymbol

Returnsthesymbolassociatedwiththepositionataspecificlocation(PositionLoc)inthelistofpositionsforthespecifiedaccount.

Usage

GetPositionSymbol(Account,PositionLoc)

Where:Account-accountnumberatbroker.1<=PositionLoc<=GetNumPositions-thesequencenumberofthepositioninthepositionlistforthespecifiedaccount.

Example

GetPositionSymbol("DU12345",3)willreturn"ESZ1"ifthepositionwiththesequencenumber3inthepositionlistforaccountDU12345isopenedonESZ1.

36

GetPositionTotalCost

Calculatedwiththefollowingformula:

PTC(PositionTotalCost)=AEP(AverageEntryPrice)xTMP(TotalMarketPosition).

Usage

GetPositionTotalCost(Symbol,Account)

Where:Symbol-thenameoftheinstrument.Account-accountnumberatbroker.

Example

GetPositionTotalCost("ESZ1","DU12345")willreturntotalpositioncostforESZ1onaccountDU1234.

37

GetRTAccountEquity

ReturnsregularAccountEquityatbroker.

Usage

GetRTAccountEquity(Account)

Where:Account-accountnameatbroker.

Example

GetRTAccountEquity("DU12345")willreturnavalueof100000iftheAccountEquityatbrokerforDU12345accountis¤100000.

38

GetRTAccountNetWorth

ReturnsAccountNetLiquidationvalueatbroker.

Usage

GetRTAccountNetWorth(Account)

Where:Account-accountnameatbroker.

Example

GetRTAccountNetWorth("DU12345")willreturnavalueof100000iftheAccountNetLiquidityatbrokerforDU12345accountis100000inbasecurrency.

39

GetRTUnrealizedPL

ReturnstheUnrealized/OpenP&L;forthespecifiedaccount.

Usage

GetRTUnrealizedPL(Account)

Where:Account-accountnumberatbroker.

Example

Willreturnavalueof5000ifUnrealized(Open)P&L;fortheaccountatbrokeris¤5000.

40

InitialCapital

Returnsanumericalvalue,indicatingtheamountofinitialcapitalsetinthestrategyproperties.

Usage

InitialCapital

Example

InitialCapitalwillreturn10000ifInitialCapitalamountwassetto10000intheStrategyProperties.

41

AlertTriggersanalertwindowwherethenecessarytextcanbecreated.Thetextcanbedynamic,staticorabsent.

Usage

Alert

Notes

Ifthetextisn'tsetinthealertthenSource,Symbol,Resolution,Priceisdisplayed

Alertsareshownonthelastbaronly

Detailedinformationofalerts'settingsisavailableinFormattingStudies>Alerts

Example

Thisstatementwillcallanalertwithouttextmessage:

Alert;

Thisstatementcreatesadynamicalerttextanddisplaysthenumberoftheweekday:

Alert(Text("Dayofweekis",DayOfWeek(Date)));

Thisstatementwillshowstatictext:

IfClose>Close[1]ThenAlert(Text("Priceturningup"))

42

AlertEnabledReturnsTrueifthealertshavebeenturnedoninFormatStudy>Alerts.Thisinformationcanmakescriptexecutionmoreefficientbydiscardingredundantcalculations.Thisfunctioncanalsobeusedtonotifytheuserthathewillnotseethealertsuntiltherelevantoptionisturnedon.

Usage

AlertEnabled

Notes

Alertsareonlygeneratedforthelastbar

ThereisadifferencebetweenAlertEnabledandCheckAlert:AlertEnabledreturnsTrue/FalseforallthebarsonthechartwhileCheckAlertdoessoforthelastbaronly

AlertEnabledwillreturnTrueifalertshavebeenenabled

Example

Theexamplebelowshowshowausercanbenotifiedthathehasforgottentoturnonthealerts:

Variable:ID(-1);

IfAlertEnabled=FalseAndLastBarOnChart_S=TrueThen

ID=Text_New_S(Date,Time_S,Low,"Alertsaredisabled.SeeFormatStudy>Properties>Alerts");

43

CancelAlertTheexpressiondeactivatesalerts.Thisisnecessaryifascriptcontainsmultiplealertstatementsandtheyneedtobeturnedoffundercertainconditions.

Usage

CancelAlert

Notes

Alertsareonlygeneratedforthelastbar

Example

Theexampleshowshowallalertscanbeturnedoffdependingontime.Thealertswillnotbedisplayedafter10:00pm.

IfClose>Close[1]ThenAlert("Priceisgoingup");IfVolume>Volume[1]ThenAlert("Volumeisincreasing");IfVolatility(5)>Volatility(5)[1]ThenAlert("Volatilityisrising");IfOpenInt>OpenInt[1]ThenAlert("Openinterestisgrowing");IfTime>=2200ThenCancelAlert;

44

CheckAlertReturnsTrueifthealertshavebeenturnedoninFormattingStudies>Alerts.

True/Falseisreturnedonthelastbaronly.

ForthebarsotherthanthelastFalseisalwaysreturned.

Usage

CheckAlert

Notes

ThereisadifferencebetweenAlertEnabledandCheckAlert.AlertEnabledchecksthestatusonallthebarswhileCheckAlertdoessoforthelastbaronly.Alertsareonlygeneratedforthelastbar.

Example

TheexamplebelowshowshowCheckAlertcanhelpeliminateredundantcalculationsonhistoricbarsaswellasincaseswhenalertsarenotturnedon:

IfCheckAlertThenBeginIfVolume>=2*Average(Volume,10)ThenAlert("Volumeisgoingup");End;

45

Arw_Anchor_to_Bars

Anchorsthecorrespondingarrowdrawingtothevisiblebarindex;returnsavalueof0iftheoperationwasperformedsuccessfully,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

Arw_Anchor_to_Bars(ArrowID,LogicalExpression)

Where:ArrowIDisanumericalexpressionspecifyingthearrowdrawingIDnumberLogicalExpressionisalogicalvalue;True=addoptionandFalse=removeoption

Notes

ArrowIDnumberisreturnedbyArw_Newwhenthearrowdrawingiscreated.

Example

AnchorthearrowdrawingwithanIDnumberof5tothevisiblebarindex:

Value1=Arw_Anchor_to_Bars(5,true);

46

Arw_Delete

RemovesanarrowobjectwiththespecifiedIDnumberfromachart;returnsavalueof0iftheobjectwassuccessfullyremoved,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_Delete(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

RemovethearrowobjectwithanIDnumberof3:

Value1=Arw_Delete(3);

47

Arw_GetActive

ReturnsanumericalvalueindicatingtheobjectIDnumberofthecurrentlyselectedarrowobject;returnsavalueof-1ifnoarrowobjectsarecurrentlyselected.

Usage

Arw_GetActive

Notes

Anobject-specificIDnumberisassignedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignavalue,indicatingtheobjectIDnumberofthecurrentlyselectedarrowobject,toValue1variable:

Value1=Arw_GetActive;

48

Arw_GetBarNumber

ReturnsanumericalvaluerepresentingthebarnumberofthearrowobjectwithaspecifiedID;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetBarNumber(ref)

Parameters:

ref-IDofthearrowobject

Example

GetthenumberofthebarwherethearrowobjectwithID=1isplaced:

Arw_GetBarNumber(1);

49

Arw_GetColor

ReturnsanRGBcolornumberoralegacycolorvaluethatcorrespondtothecolorofthearrowcontainedinanarrowobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetColor(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

AssignanRGBcolornumber,correspondingtothecolorofthearrowcontainedinanarrowobjectwiththeIDnumberof3,toValue1variable:

Value1=Arw_GetColor(3);

Assignalegacycolorvalue,correspondingtothecolorofthearrowcontainedinanarrowobjectwiththeIDnumberof3,toValue1variable:

[LegacyColorValue=True];Value1=Arw_GetColor(3);

50

Arw_GetDate

Returnsanumericalvalue,indicatingthedateofthebaratwhichanarrowobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

Arw_GetDate(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignavalue,indicatingthedateofthebaratwhichanarrowobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Arw_GetDate(3);

51

Arw_GetDirection

ReturnsalogicalvalueindicatingthedirectionofthearrowcontainedinanarrowobjectwiththespecifiedIDnumber;returnsavalueofTrueforDownarrow,andavalueofFalseforUparroworifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetDirection(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignatrue/falsevalue,indicatingthedirectionofthearrowcontainedinanarrowobjectwiththeIDnumberof3,toDownArrowvariable:

Variable:DownArrow(False);DownArrow=Arw_GetDirection(3);

52

Arw_GetFirst

Returnsanumericalvalue,indicatingtheobjectIDnumberoftheoldest(thefirsttobeaddedtothecurrentchart)arrowobjectofthespecifiedorigin;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetFirst(Origin)

Parameters

Origin-anumericalexpressionspecifyingtheoriginofthearrowobject:

1-addedbythecurrentstudy2-addedbyastudyotherthenthecurrentstudy,ordrawnmanuallybytheuser3-addedbyanystudy,ordrawnmanuallybytheuser4-addedbythecurrentstudy,ordrawnmanuallybytheuser5-addedbyastudyotherthenthecurrentstudy6-addedbyanystudy7-addedmanuallybytheuser

Notes

Iftheoldest(thefirstadded)arrowobjectisdeleted,thenextoldest(thesecondadded)arrowobjectbecomestheoldest(thefirstadded)arrowobject.

Example

Assignavalue,indicatingtheobjectIDnumberoftheoldestarrowobjectaddedtothechartbythecurrentstudy,toValue1variable:

Value1=Arw_GetFirst(1);

53

Arw_GetLock

Lockedarrowdrawingscannotbemovedmanually.KeywordreturnsavalueofTrueforlockeddrawings,andavalueofFalseforunlocked.

Usage

Arw_GetLock(ArrowID)

Where:ArrowID-anumericalexpressionspecifyingthearrowdrawingIDnumber

Notes

AnarrowIDnumberisreturnedbyArw_Newwhenthearrowdrawingiscreated.

Example

AssignLockpropertyofthearrowdrawingwithanIDnumberof3toCondition1variable:

Condition1=Arw_GetLock(3);

54

Arw_GetNext

ReturnstheIDnumberofthefirstexistingarrowobjectaddedsubsequenttoanarrowobjectwiththespecifiedIDnumber,withbothobjectsofaspecifiedorigin;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetNext(ObjectID,Origin)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Origin-anumericalexpressionspecifyingtheoriginofthearrowobjects:

1-addedbythecurrentstudy2-addedbyastudyotherthenthecurrentstudy,ordrawnmanuallybytheuser3-addedbyanystudy,ordrawnmanuallybytheuser4-addedbythecurrentstudy,ordrawnmanuallybytheuser5-addedbyastudyotherthenthecurrentstudy6-addedbyanystudy7-addedmanuallybytheuser

Example

AssignavaluetoValue1variable,indicatingtheIDnumberofthefirstexistingarrowobjectaddedsubsequenttoanarrowobjectwiththeIDnumberof3,withbothobjectsaddedbythecurrentstudy:

Value1=Arw_GetNext(3,1);

55

Arw_GetSize

ReturnsanumericalvalueindicatingthesizeofthearrowcontainedinanarrowobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetSize(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignavalue,indicatingthesizeofthearrowinanarrowobjectwiththeIDnumberof3,toValue1variable:

Value1=Arw_GetSize(3);

56

Arw_GetStyle

Returnsanumericalvalue,indicatingthestyleofthearrowinanarrowobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetStyle(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignavalue,indicatingthestyleofthearrowinanarrowobjectwiththeIDnumberof3,toValue1variable:

Value1=Arw_GetStyle(3);

57

Arw_GetText

ReturnsastringexpressioncorrespondingtothetextcontainedinanarrowobjectwiththespecifiedIDnumber.

Usage

Arw_GetText(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Arw_GetText(3)willreturnastringexpressioncorrespondingtothetextcontainedinanarrowobjectwiththeIDnumberof3

58

Arw_GetTextAttribute

ReturnsalogicalvalueindicatingthesettingforanattributeofthetextinanarrowobjectwiththespecifiedIDnumber;returnsavalueofTrueiftheattributeissettoon,andavalueofFalseiftheattributeissettoofforifthespecifiedobjectIDnumberisinvalid.

Thesettingsofthefollowingattributescanbereturned:border,bold,italic,strike-out,andunderline.

Usage

Arw_GetTextAttribute(ObjectID,Attribute)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Attribute-anumericalexpressionspecifyingtheattribute:

0-border1-bold2-italic3-strike-out4-underline

Notes

Anobject-specificIDnumberisassignedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignatrue/falsevalue,indicatingthesettingof"bold"attributeforthearrowobjectwithanIDnumberof3,toArwTxtBoldvariable:

59

Variable:ArwTxtBold(False);ArwTxtBold=Arw_GetTextAttribute(3,1);

60

Arw_GetTextBGColor

ReturnsanRGBcolornumberoralegacycolorvaluethatcorrespondtothetextbackgroundcolorofanarrowobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetTextBGColor(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

AssignanRGBcolornumber,correspondingtothetextbackgroundcolorofanarrowobjectwiththeIDnumberof3,toValue1variable:

Value1=Arw_GetTextBGColor(3);

Assignalegacycolorvalue,correspondingtothetextbackgroundcolorofanarrowobjectwiththeIDnumberof3,toValue1variable:

[LegacyColorValue=True];Value1=Arw_GetTextBGColor(3);

61

Arw_GetTextColor

ReturnsanRGBcolornumberoralegacycolorvaluethatcorrespondtothecolorofthetextcontainedinanarrowobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetTextColor(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

AssignanRGBcolornumber,correspondingtothecolorofthetextcontainedinanarrowobjectwiththeIDnumberof3,toValue1variable:

Value1=Arw_GetTextColor(3);

Assignalegacycolorvalue,correspondingtothecolorofthetextcontainedinanarrowobjectwiththeIDnumberof3,toValue1variable:

[LegacyColorValue=True];Value1=Arw_GetTextColor(3);

62

Arw_GetTextFontName

ReturnsastringexpressioncorrespondingtothenameofthetextfontassignedtoanarrowobjectwiththespecifiedIDnumber.

Usage

Arw_GetTextFontName(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Arw_GetTextFontName(3)willreturnastringexpressioncorrespondingtothenameofthetextfontassignedtoanarrowobjectwiththeIDnumberof3

63

Arw_GetTextSize

ReturnsanumericalvalueindicatingthefontsizeassignedtothetextofanarrowobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetTextSize(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignavalue,indicatingthefontsizeofthetextinanarrowobjectwiththeIDnumberof3,toValue1variable:

Value1=Arw_GetTextSize(3);

64

Arw_GetTime

Returnsanumericalvalue,indicatingthetimeofthebaratwhichanarrowobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

Arw_GetTime(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignavalue,indicatingthetimeofthebaratwhichanarrowobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Arw_GetTime(3);

65

Arw_GetTime_DT

Returnsadouble-precisiondecimalDateTimevalueindicatingthetimeofthebaratwhichanarrowobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

ThetimeisindicatedintheDateTimeformat,wheretheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

Arw_GetTime_DT(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_New_dtwhenthearrowobjectiscreated.

Example

Assignavalue,indicatingthetimeofthebaratwhichanarrowobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Arw_GetTime_DT(3);

66

Arw_GetTime_s

Returnsanumericalvalueindicatingthetimeofthebar,includingseconds,atwhichanarrowobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM.

Usage

Arw_GetTime_s(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_New_swhenthearrowobjectiscreated.

Example

Assignavalue,indicatingthetimeofthebaratwhichanarrowobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Arw_GetTime_s(3);

67

Arw_GetVal

Returnsthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),atwhichanarrowobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_GetVal(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignavalue,indicatingthepricevalueatwhichanarowobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Arw_GetVal(3);

68

Arw_Get_Anchor_to_Bars

Returnsthevalueof"anchortobar"optionofthearrowdrawingwithaspecifiedID.

Usage

Arw_Get_Anchor_to_Bars(ArrowID)

Where:ArrowIDisanumericalexpressionspecifyingthearrowdrawingIDnumber

Notes

AnarrowIDnumberisreturnedbyArw_Newwhenthearrowdrawingiscreated.

Example

Assign"anchortobars"optionofthearrowdrawingwithanIDnumberof3totheCondition1variable:

Condition1=Arw_Get_Anchor_to_Bars(3);

69

Arw_Lock

Lockscorrespondingarrowdrawingsoitcannotbemovedmanually;returnsavalueof0iftheoperationwasperformedsuccessfully,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

Arw_Lock(ArrowID,LogicalExpression)

Where:ArrowID-anumericalexpressionspecifyingthearrowdrawingIDnumberLogicalExpression-alogicalvalue;True=AddandFalse=Remove

Notes

AnarrowIDnumberisreturnedbyArw_Newwhenthearrowdrawingiscreated.

Example

LockthearrowdrawingwithanIDnumberof3:

Value1=Arw_Lock(3,True);

UnlockthearrowdrawingwithanIDnumberof5:

Value1=Arw_Lock(5,False);

70

Arw_New

Displaysanobject,consistingofanuporadownarrowlocatedatthespecifiedbarandspecifiedpricevalue,onthechartthatthestudyisbasedon;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Arw_New(BarDate,BarTime,PriceValue,Direction)

Parameters

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime-anumericalexpressionspecifyingthetimeofthebaratwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Direction-alogicalexpressionspecifyingthedirectionofthearrow;True=DownandFalse=Up

Example

Place,onthechartthatthestudyisbasedon,anuparrowatthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Arw_New(Date,Time,High,False);

71

Arw_New_BN

Displaysanobjectconsistingofanuporadownarrowlocatedatthespecifiedbarandspecifiedpricevalueonthechartthatthestudyisbasedon;returnsanobject-specificIDnumberrequiredtomodifytheobject.

Usage

Arw_New_BN(BarNumber,PriceValue,Direction)

Parameters

BarNumber-anumericalexpressionspecifyingthebarnumberatwhichtheobjectistobeplaced.

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectshouldbeplaced.

Direction-alogicalexpressionspecifyingthedirectionofthearrow;True=DownandFalse=Up

Example

Onthechartthatthestudyisbasedon,placeanuparrowatthetopofacurrentbariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Arw_New_BN(currentbar,High,False);

72

Arw_New_DT

Displaysanobject,consistingofanuporadownarrowlocatedatthespecifiedbarandspecifiedpricevalue,onthechartthatthestudyisbasedon;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Arw_New_DT(Bar_DateTime,PriceValue,Direction)

Parameters

Bar_DateTime-anumericalexpressionspecifyingthedateandtimeofthebaratwhichtheobjectistobeplaced.ThedateandtimeareindicatedintheDateTimeformat,wheretheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced.

Direction-alogicalexpressionspecifyingthedirectionofthearrow;True=DownandFalse=Up

Example

Place,onthechartthatthestudyisbasedon,anuparrowatthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Arw_New_DT(DateTime,High,False);

73

Arw_New_s

Displaysanobject,consistingofanuporadownarrowlocatedatthespecifiedbarandspecifiedpricevalue,onthechartthatthestudyisbasedon;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Arw_New_s(BarDate,BarTime_s,PriceValue,Direction)

Parameters

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime_s-anumericalexpressionspecifyingthetimeofthebar,includingseconds,atwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Direction-alogicalexpressionspecifyingthedirectionofthearrow;True=DownandFalse=Up

Example

Place,onthechartthatthestudyisbasedon,anuparrowatthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Arw_New_s(Date,Time_s,High,False);

74

Arw_New_self

Displaysanobject,consistingofanuporadownarrowlocatedatthespecifiedbarandspecifiedpricevalue,ontheSubChartcontainingthestudy;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Arw_New_self(BarDate,BarTime,PriceValue,Direction)

Parameters

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime-anumericalexpressionspecifyingthetimeofthebaratwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Direction-alogicalexpressionspecifyingthedirectionofthearrow;True=DownandFalse=Up

Example

Place,ontheSubChartcontainingthestudy,anuparrowatthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Arw_New_self(Date,Time,High,False);

75

ARW_New_Self_BNThesameasArw_New_BN.Difference:DisplaysaarrowontheSubChartcontainingthestudy.

76

Arw_New_Self_DT

Displaysanobject,consistingofanuporadownarrowlocatedatthespecifiedbarandspecifiedpricevalue,ontheSubChartcontainingthestudy;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Arw_New_Self_DT(Bar_DateTime,PriceValue,Direction)

Parameters

Bar_DateTime-anumericalexpressionspecifyingthedateandtimeofthebaratwhichtheobjectistobeplaced.ThedateandtimeareindicatedintheDateTimeformat,wheretheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced.

Direction-alogicalexpressionspecifyingthedirectionofthearrow;True=DownandFalse=Up

Example

Place,ontheSubChartcontainingthestudy,anuparrowatthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Arw_New_Self_DT(DateTime,High,False);

77

Arw_New_self_s

Displaysanobject,consistingofanuporadownarrowlocatedatthespecifiedbarandspecifiedpricevalue,ontheSubChartcontainingthestudy;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Arw_New_self_s(BarDate,BarTime_s,PriceValue,Direction)

Parameters

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime_s-anumericalexpressionspecifyingthetimeofthebar,includingseconds,atwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Direction-alogicalexpressionspecifyingthedirectionofthearrow;True=DownandFalse=Up

Example

Place,ontheSubChartcontainingthestudy,anuparrowatthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Arw_New_self_s(Date,Time_s,High,False);

78

Arw_SetBarNumber

AssignsthespecifiedbarnumbertothearrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthebarnumberwassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetBarNumber(ref,Barnumber)

Parameters:

ref-IDofthearrowobjectBarnumber-thenewbarnumberthatistobeassignedtothespecifiedobject.

Example

Assignthenewbarnumbervalueof100tothearrowobjectwithID=1:

Arw_SetBarNumber(1,100);

79

Arw_SetColor

AssignsthespecifiedcolortothearrowcontainedinanarrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthecolorwassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetColor(ObjectID,ArrowColor)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

ArrowColor-anexpressionspecifyingthecolorofthearrow

ThecolorcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumberoralegacycolorvalue,orbyoneof17basecolorwords.

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

AssignthecolorbluetothearrowcontainedinanarrowobjectwiththeIDnumberof3:

Value1=Arw_SetColor(3,Blue);

AssigntheRGBcolor2138336(Orange)tothearrowcontainedinanarrowobjectwiththeIDnumberof3:

Value1=Arw_SetColor(3,2138336);

80

Assignthelegacycolor4(Green)tothearrowcontainedinanarrowobjectwiththeIDnumberof3:

[LegacyColorValue=True];Value1=Arw_SetColor(3,4);

81

Arw_SetLocation

ModifiesthelocationofanarrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthelocationoftheobjectwassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetLocation(ObjectID,BarDate,BarTime,PriceValue)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime-anumericalexpressionspecifyingthetimeofthebaratwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

MovethearrowobjectwithanIDnumberof3tothetopofthecurrentbar:

Value1=Arw_SetLocation(3,Date,Time,High);

82

83

Arw_SetLocation_BN

ModifieslocationofanarrowobjectwiththespecifiedIDnumber;returnsavalueof0iflocationoftheobjectwassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetLocation_BN(ObjectID,BarNumber,PriceValue)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber.

BarNumber-anumericalexpressionspecifyingthebarnumberatwhichtheobjectistobeplaced.

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectshouldbeplaced.

Notes

Anobject-specificIDnumberisreturnedbyArw_New_Dtwhenthearrowobjectiscreated.

Example

MovethearrowobjectwithanIDnumberof3tothetopofthecurrentbar:

Value1=Arw_SetLocation_BN(3,currentbar,High);

84

Arw_SetLocation_DT

ModifiesthelocationofanarrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthelocationoftheobjectwassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetLocation_DT(ObjectID,Bar_DateTime,PriceValue)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber.

Bar_DateTime-anumericalexpressionspecifyingthedateandtimeofthebaratwhichtheobjectistobeplaced.ThedateandtimeareindicatedintheDateTimeformat,wheretheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced.

Notes

Anobject-specificIDnumberisreturnedbyArw_New_Dtwhenthearrowobjectiscreated.

Example

MovethearrowobjectwithanIDnumberof3tothetopofthecurrentbar:

Value1=Arw_SetLocation_DT(3,DateTime,High);

85

86

Arw_SetLocation_s

ModifiesthelocationofanarrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthelocationoftheobjectwassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetLocation_s(ObjectID,BarDate,BarTime_s,PriceValue)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime_s-anumericalexpressionspecifyingthetimeofthebar,includingseconds,atwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Notes

Anobject-specificIDnumberisreturnedbyArw_New_swhenthearrowobjectiscreated.

Example

MovethearrowobjectwithanIDnumberof3tothetopofthecurrentbar:

Value1=Arw_SetLocation_s(3,Date,Time_s,High);

87

88

Arw_SetSize

AssignsthespecifiedsizetothearrowcontainedinanarrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthesizewassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetSize(ObjectID,ArrowSize)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumberArrowSize-anumericalexpressionspecifyingthearrowsize

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignanarrowsizeof10tothearrowobjectwithanIDnumberof3:

Value1=Arw_SetSize(3,10);

89

Arw_SetStyle

AssignsthespecifiedstyletothearrowofanarrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthearrowstylewassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetStyle(ObjectID,ArrowStyle)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumberArrowStyle-anumericalexpressionspecifyingthearrowstyle;arrowstylesrangefrom0to13

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignthearrowstyleof5toanarrowobjectwiththeIDnumberof3:

Value1=Arw_SetStyle(3,5);

90

Arw_SetText

Addstextto,orreplacestheexistingtextcontainedinanarrowobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetText(ObjectID,"Text")

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumberText-thestringexpressiontobedisplayedinthearrowobject

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Addtext"MyArrow"tothearrowobjectwithanIDnumberof3:

Value1=Arw_SetText(3,"MyArrow");

ReplacetextcontainedinthearrowobjectwithanIDnumberof3withthestringexpression"NewText":

Value1=Arw_SetText(3,"NewText");

91

Arw_SetTextAttribute

SetsanattributeofthetextinanarrowobjectwiththespecifiedIDnumber;returnsavalueof0iftheattributewassuccessfullyset,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Thefollowingtextattributescanbeset:border,bold,italic,strike-out,andunderline.

Usage

Arw_SetTextAttribute(ObjectID,Attribute,LogicalExpression)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Attribute-anumericalexpressionspecifyingtheattribute:

0-border1-bold2-italic3-strike-out4-underline

LogicalExpression-alogicalvalue;True=onandFalse=off

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Settheattribute"bold"toonforthetextinanarrowobjectwiththeIDnumberof3:

92

Value1=Arw_SetTextAttribute(3,1,True);

93

Arw_SetTextBGColor

AssignsthespecifiedbackgroundcolortothetextofanarrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthecolorwassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetTextBGColor(ObjectID,TextBGColor)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

TextBGColor-anexpressionspecifyingthetextbackgroundcolor

ThecolorcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumberoralegacycolorvalue,orbyoneof17basecolorwords.

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

AssignthecolorbluetothetextbackgroundofanarrowobjectwiththeIDnumberof3:

Value1=Arw_SetTextBGColor(3,Blue);

AssigntheRGBcolor2138336(Orange)tothetextbackgroundofanarrowobjectwiththeIDnumberof3:

Value1=Arw_SetTextBGColor(3,2138336);

94

Assignthelegacycolor4(Green)tothetextbackgroundofanarrowobjectwiththeIDnumberof3:

[LegacyColorValue=True];Value1=Arw_SetTextBGColor(3,4);

95

Arw_SetTextColor

AssignsthespecifiedcolortothetextcontainedinanarrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthecolorwassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetTextColor(ObjectID,TextColor)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

TextColor-anexpressionspecifyingthecolorofthetext

ThecolorcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumberoralegacycolorvalue,orbyoneof17basecolorwords.

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

AssignthecolorbluetothetextcontainedinanarrowobjectwiththeIDnumberof3:

Value1=Arw_SetTextColor(3,Blue);

AssigntheRGBcolor2138336(Orange)tothetextcontainedinanarrowobjectwiththeIDnumberof3:

Value1=Arw_SetTextColor(3,2138336);

96

Assignthelegacycolor4(Green)tothetextcontainedinanarrowobjectwiththeIDnumberof3:

[LegacyColorValue=True];Value1=Arw_SetTextColor(3,4);

97

Arw_SetTextFontName

AssignsthespecifiedfonttothetextofanarrowobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

AnyfontintheFontsfoldercanbeused;thefolderisaccessiblefromtheControlPanelinWindowsXPoperatingsystem.

Usage

Arw_SetTextFontName(ObjectID,"FontName")

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumberFontName-astringexpressionspecifyingthefontname

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

AssignfontVerdanatothetextofanarrowobjectwiththeIDnumberof3:

Value1=Arw_SetTextFontName(3,"Verdana");

98

Arw_SetTextSize

AssignsthespecifiedfontsizetothetextofanarrowobjectwiththespecifiedIDnumber;returnsavalueof0ifthefontsizewassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Arw_SetTextSize(ObjectID,FontSize)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumberFontSize-anumericalexpressionspecifyingthefontsize

Notes

Anobject-specificIDnumberisreturnedbyArw_Newwhenthearrowobjectiscreated.

Example

Assignthefontsizeof16tothetextofanarrowobjectwiththeIDnumberof3:

Value1=Arw_SetTextSize(3,16);

99

MC_Arw_GetActiveReturnsanumericalvalueindicatingthearrowIDnumberofthecurrentlyselectedarrow;returnsavalueof-1ifnoarrowsarecurrentlyselected.

Usage

MC_Arw_GetActive

Example

Assignavalue,indicatingthearrowIDnumberofthecurrentlyselectedarrow,toValue1variable:Value1=MC_Arw_GetActive;

100

AllowSendOrdersAlways

AttributesettoTrueallowsordergenerationevenwhenbarstatusisnotdefined(-1willbereturned).

Usage

[AllowSendOrdersAlways=LogicalValue]

Where:LogicalValue-atrue/falsevalue;True=Enable;False=Disable

IftheattributeissettoFalse,ornotpresentinthestudy'scode,itdoesn'tallowordergenerationwhenbarstatusisnotdefined.

IftheattributeissettoTrue,thenallowsgenerationevenwhenbarstatus=-1.

Example

EnableAllowSendOrdersAlwaysvalue:

[AllowSendOrdersAlways=True];

101

IntraBarOrderGeneration

Togglesintra-barordergenerationflagonoroff.

Usage

[IntrabarOrderGeneration=LogicalValue]

Where:LogicalValue-atrue/falsevalue;True=Enable;False=Disable

Iftheattributeisnotpresentinthestudy'scode,intra-barordergenerationcanbesetbytheuserintheCalculationstaboftheFormatSignalwindow.

IfsettoTrue,"Enableintra-barordergenerationandcalculation"checkboxwillbecheckedandgrayedout,andtheradiobuttonswillbeavailable.

IfsettoFalse,"Enableintra-barordergenerationandcalculation"checkboxwillbeuncheckedandgrayedout,andtheradiobuttonsdisabled.

Notes

Attributesareappliedatthetimeofcompilationandcannotbechangedatrun-time.

Example

Enableintra-barordergeneration:

[IntrabarOrderGeneration=True];

102

LegacyColorValue

Specifiesthecolordesignationschemetobeusedforinterpretationofnumericalcolorvalues.

Usage

[LegacyColorValue=LogicalValue]

Where:LogicalValue-atrue/falsevalue;True=Enable;False=Disable

IftheattributeissettoFalse,ornotpresentinthestudy'scode,theRGB(new)16Mcolorschemewillbeused.

IfLegacyColorValuetheattributeissettoTrue,thelegacy(old)16-bit,16-colorschemewillbeused.

Notes

Whenacolornameisconvertedtoanumericalcolorvalue,thespecifiedschemewillbefollowed.

Toensurecompatibility,theattribute[LegacyColorValue=True]isinsertedautomaticallywhenolderversions,priortov8.1,ofEasyLanguagestudiesareimported.

Example

Enablelegacycolorvalueinterpretation:

[LegacyColorValue=True];

CreateaGreencolorplotusingthelegacycolorscheme:

[LegacyColorValue=True];

103

Plot1(Open);

SetPlotColor(1,4);

CreateaGreencolorplotusingtheRGBcolorscheme:

[LegacyColorValue=False];

Plot1(Open);

SetPlotColor(1,65280);

Assignavalue,representingthecolorGreenunderthelegacycolorscheme,toValue1(Value1willbeassignedavalueof4):

[LegacyColorValue=True];

Value1=Green;

Assignavalue,representingthecolorGreenundertheRGBcolorscheme,toValue1(Value1willbeassignedavalueof65280):

[LegacyColorValue=False];

Value1=Green;

104

ProcessMouseEvents

Declaresthatthestudyprocessesmouseevents.

Usage

[ProcessMouseEvents=LogicalValue]

Where:LogicalValue-atrue/falsevalue;True=Enable;False=Disable

Notes

Ifthisattributeisnotpresentinthestudy'scode,theindicatorbasedinthemouseeventswillnotbecalculated.Canbeusedonlyinsignalsandindicators

Example

[ProcessMouseEvents=True];

105

SameExitFromOneEntryOnce

AttributedefinespossibilityofpositionExitusingoneandthesameorder.Ifitisnotspecifiedinthescript,thensettoTruebydefault.

Usage

[SameExitFromOneEntryOnce=LogicalValue]

Where:LogicalValue-atrue/falsevalue;True=Enable;False=Disable

IftheattributeissettoTrue,ornotpresentinthestudy'scode,thenexitfromthespecifiedpositionusingoneandthesameorderisnotpossible.

IftheattributeissettoFalse,thenspecifiedpositioncanbeclosedusingoneandthesameorderunlimitedly.

Example

DisableSameExitFromOneEntryOncevalueinterpretation:

[SameExitFromOneEntryOnce=False];

buy5contractsnextbarmarket;

sell1contractsnextbarmarket;

WhenbacktestingthegivenstrategyoneandthesameExitorder(generatedbysellnextbarmarketcommand)isappliedforpartialpositionclose5times.

Commentingoutthefirstscriptlinedefaultbehaviorwillbeobtained.Exitorderwilltriggeronlyonce.

106

Black

Constant,usedtodesignatethecolorBlack.

Usage

Black

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorBlack:

Plot1(Open);SetPlotColor(1,Black);

107

Blue

Constant,usedtodesignatethecolorBlue.

Usage

Blue

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorBlue:

Plot1(Open);SetPlotColor(1,Blue);

108

Cyan

Constant,usedtodesignatethecolorCyan.

Usage

Cyan

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorCyan:

Plot1(Open);SetPlotColor(1,Cyan);

109

DarkBlue

Constant,usedtodesignatethecolorDarkBlue.

Usage

DarkBlue

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorDarkBlue:

Plot1(Open);SetPlotColor(1,DarkBlue);

110

DarkBrown

Constant,usedtodesignatethecolorDarkBrown.

Usage

DarkBrown

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorDarkBrown:

Plot1(Open);SetPlotColor(1,DarkBrown);

111

DarkCyan

Constant,usedtodesignatethecolorDarkCyan.

Usage

DarkCyan

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorDarkCyan:

Plot1(Open);SetPlotColor(1,DarkCyan);

112

DarkGray

Constant,usedtodesignatethecolorDarkGray.

Usage

DarkGray

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorDarkGray:

Plot1(Open);SetPlotColor(1,DarkGray);

113

DarkGreen

Constant,usedtodesignatethecolorDarkGreen.

Usage

DarkGreen

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorDarkGreen:

Plot1(Open);SetPlotColor(1,DarkGreen);

114

DarkMagenta

Constant,usedtodesignatethecolorDarkMagenta.

Usage

DarkMagenta

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorDarkMagenta:

Plot1(Open);SetPlotColor(1,DarkMagenta);

115

DarkRed

Constant,usedtodesignatethecolorDarkRed.

Usage

DarkRed

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorDarkRed:

Plot1(Open);SetPlotColor(1,DarkRed);

116

DarkYellow

Constant,usedtodesignatethecolorDarkYellow.

Usage

DarkYellow

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorDarkYellow:

Plot1(Open);SetPlotColor(1,DarkYellow);

117

GetBValueReturnstheBluecolorcomponentvalueofanRGBcolornumber;thevaluerangesfrom0to255.

Usage

GetBValue(BigRGBValue)

Where:BigRGBValue-anRGBcolornumberfrom0to16777215

Example

Assignavalue,representingtheBluecolorcomponentoftheRGBcolornumber2138336(Orange),toValue1(Value1willbeassignedavalueof32):

Value1=GetBValue(2138336);

118

GetGValueReturnstheGreencolorcomponentvalueofanRGBcolornumber;thevaluerangesfrom0to255.

Usage

GetGValue(BigRGBValue)

Where:BigRGBValue-anRGBcolornumberfrom0to16777215

Example

Assignavalue,representingtheGreencolorcomponentoftheRGBcolornumber2138336(Orange),toValue1(Value1willbeassignedavalueof160):

Value1=GetGValue(2138336);

119

GetRValueReturnstheRedcolorcomponentvalueofanRGBcolornumber;thevaluerangesfrom0to255.

Usage

GetRValue(BigRGBValue)

Where:BigRGBValue-anRGBcolornumberfrom0to16777215

Example

Assignavalue,representingtheRedcolorcomponentoftheRGBcolornumber2138336(Orange),toValue1(Value1willbeassignedavalueof224):

Value1=GetRValue(2138336);

120

GradientColorReturnsanRGBcolornumber,representingashadeofcolorfromwithinadefinedcolorrange.Thegradientshadeofcolorisdeterminedbythevalueofthespecifiednumericalexpressioninrelationtothedefinedvaluerange.

Forexample,ifthecolorrangeisdefinedasWhitetoBlack,andthevaluerangeisdefinedfrom0to2,GradientColorwillreturnanRGBcolornumberrepresentingWhiteforthevalueof0,Grayforthevalueof1,andBlackforthevalueof2.Whitewillbereturnedforallvalues<0,andBlackforallvalues>2.

Usage

GradientColor(Value,Min,Max,StartColor,EndColor)

Where:ValuethespecifiednumericalexpressionMintheminimumvalueofthevaluerange;ifValue=Min,StartColorisreturnedMaxthemaximumvalueofthevaluerange;ifValue=Max,EndColorisreturnedStartColorthestartingcolorofthecolorrangeEndColortheendingcolorofthecolorrange

Example

PlotanADXindicatorinGradientColor,whereMagentagraduallychangesintoWhitefortheindicatorvaluesfrom5to50:

Variable:ADXValue(0);ADXValue=ADX(14);Plot1(ADXValue,"ADXValue");SetPlotColor(1,GradientColor(ADXValue,5,50,Magenta,White));

121

Green

Constant,usedtodesignatethecolorGreen.

Usage

Green

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorGreen:

Plot1(Open);SetPlotColor(1,Green);

122

LegacyColorToRGBReturnsanRGBcolornumberthatcorrespondstothespecifiedlegacycolorvalue;thenumberrangesfrom0to16777215.

Usage

LegacyColorToRGB(LegacyColorValue)

Where:LegacyColorValue-alegacycolorvaluefrom1to16

Example

Assignavalue,representingthecolor4(Green)underthelegacycolorscheme,toValue1(Value1willbeassignedavalueof65280):

Value1=LegacyColorToRGB(4);

123

LightGray

Constant,usedtodesignatethecolorLightGray.

Usage

LightGray

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorLightGray:

Plot1(Open);SetPlotColor(1,LightGray);

124

Magenta

Constant,usedtodesignatethecolorMagenta.

Usage

Magenta

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorMagenta:

Plot1(Open);SetPlotColor(1,Magenta);

125

Red

Constant,usedtodesignatethecolorRed.

Usage

Red

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorRed:

Plot1(Open);SetPlotColor(1,Red);

126

RGBReturnsanRGBcolornumberthatcorrespondstothespecifiedcombinationofred,green,andbluecomponentcolorvalues;thenumberrangesfrom0to16777215andrepresentsoneof16Mcolors.

Usage

RGB(Red,Green,Blue)

Where:Redanumericalvaluefrom0to255,specifyingtheRedcomponentoftheRGBcolorGreenanumericalvaluefrom0to255,specifyingtheGreencomponentoftheRGBcolorBlueanumericalvaluefrom0to255,specifyingtheBluecomponentoftheRGBcolor

Example

CreateanOrangecolorplotusingtheRGBcolorcombination:

Plot1(Open);SetPlotColor(1,RGB(224,160,32));

127

RGBToLegacyColorReturnsthelegacycolorvaluethatmostcloselymatchesthespecifiedRGBcolornumber;thevaluerangesfrom0to16.

Usage

RGBToLegacyColor(RGBColorValue)

Where:RGBColorValue-anRGBcolornumberfrom0to16777215

Example

Assignavalue,representingthecolor65280(Green)undertheRGBcolorscheme,toValue1(Value1willbeassignedavalueof4):

Value1=RGBToLegacyColor(65280);

128

White

Constant,usedtodesignatethecolorWhite.

Usage

White

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorWhite:

Plot1(Open);SetPlotColor(1,White);

129

Yellow

Constant,usedtodesignatethecolorYellow.

Usage

Yellow

Notes

Thebase17colorscanbedesignatedbyconstants.

Example

CreateaplotusingthecolorYellow:

Plot1(Open);SetPlotColor(1,Yellow);

130

AboveUsedincombinationwithCrosstospecifythedirectionofthecross.

Abovespecifiesanupward(lessertoagreatervalue)direction.

TheplotofAisdefinedashavingcrossedAbovetheplotofBifthevalueofAisgreaterthanthevalueofBandoneofthefollowingistrue:

a)ThevalueofAwaslessthanthevalueofBonthebarimmediatelyprecedingthecurrentbar

or

b)ThevaluesofAandBwereequalforaconsecutivesequenceofoneormorebarsimmediatelyprecedingthecurrentbarandthevalueofAwaslessthanthevalueofBonthebarimmediatelyprecedingthissequenceofbars.

FormoreinformationseeCross.

Usage

E1CrossAboveE2

or:

Plot1CrossAbovePlot2

Where:E-anumericalexpression

Example

TriggeranalertonthebarwheretheClosepricecrossesabove1350.00:

Plot1(Close);IfPlot1CrossAbove1350.50ThenAlert("Pricehascrossedabove1350.00");

131

AndAlogical(Boolean)operatorthatreturnsTrueonlyifbothofitsoperandsaretrue.Logicaloperatorsareusedinlogical(Boolean)expressionsthatoperatewithtrue/falsevalues.

Usage

E1AndE2

Where:E-true/falseexpressions

Example

2=1And2=2willreturnavalueofFalse

TrueAndTrueAndTruewillreturnavalueofTrue

132

BeginUsedincombinationwithEndtogroupinstructionsforconditionalexecution;aBeginmustalwaysbefollowedbyanEnd.

BeginandEndcanbeusedwithThen,Else,For,andWhileconditionalstatements.

Beginshouldnotbefollowedbyasemicolon(;),codelineswithinaninstructiongroupshouldendwithasemicolon(;),andonlythelastinstanceofEndwithinthesameconditionalexecutionstatementshouldbefollowedbyasemicolon(;).

Usage

CSBeginI1;I2;

I3;

End;

Where:CS-conditionalstatementI-conditionalinstructions

Example

IfUpTrendistruethenbuy,otherwisesellshort:

IfUpTrendThenBeginBuyNextBarMarket;End

ElseBegin

SellShortNextBarMarket;End;

133

BelowUsedincombinationwithCrosstospecifythedirectionofthecross.

Belowspecifiesadownward(greatertoalesservalue)direction.

TheplotofAisdefinedashavingcrossedBelowtheplotofBifthevalueofAislessthanthevalueofBandoneofthefollowingistrue:

a)ThevalueofAwasmorethanthevalueofBonthebarimmediatelyprecedingthecurrentbar,

or

b)ThevaluesofAandBwereequalforaconsecutivesequenceofoneormorebarsimmediatelyprecedingthecurrentbarandthevalueofAwasmorethanthevalueofBonthebarimmediatelyprecedingthissequenceofbars.

FormoreinformationseeCross.

Usage

E1CrossBelowE2

or:

Plot1CrossBelowPlot2

Where:E-anumericalexpression

Example

TriggeranalertonthebarwheretheClosepricecrossesbelow1350.00:

Plot1(Close);IfPlot1CrossBelow1350.50ThenAlert("Pricehascrossedbelow1350.00");

134

BreakBreakstheloopexecution.

Usage

Break;

Example

Forvalue1=0to10BeginIf(close[value1]=open[value1])thenBreak;End;Ifvalue1<=10thenprint("Open=Close",value1:0:0,"barsago.");

135

casePartofswitch-caseoperator.

Usage

Seeinexample

Example

switchgetplotcolor(1)begincasegreen:print("Indicatoringreenzoneonbar",currentbar);casered:print("Indicatorinredzoneonbar",currentbar);casered:print("Indicatorisneutralonbar",currentbar);end;

136

CrossReturnsavalueofTrueif,onthecurrentbar,theplotofanumericalexpressionAcrossedtheplotofanumericalexpressionBinthespecifieddirection.

Above,Over,Below,orUnderparametersspecifythedirectionofthecross;AboveandOveraretransposableandspecifyanupward(lessertoagreatervalue)direction,andBelowandUnderaretransposableandspecifyadownward(greatertoalesservalue)direction.

TheplotofAisdefinedashavingcrossedAboveorOvertheplotofBifthevalueofAisgreaterthanthevalueofBandoneofthefollowingistrue:

a)ThevalueofAwaslessthanthevalueofBonthebarimmediatelyprecedingthecurrentbar

or

b)ThevaluesofAandBwereequalforaconsecutivesequenceofoneormorebarsimmediatelyprecedingthecurrentbarandthevalueofAwaslessthanthevalueofBonthebarimmediatelyprecedingthissequenceofbars.

TheplotofAisdefinedashavingcrossedBeloworUndertheplotofBifthevalueofAislessthanthevalueofBandoneofthefollowingistrue:

a)ThevalueofAwasmorethanthevalueofBonthebarimmediatelyprecedingthecurrentbar,

or

b)ThevaluesofAandBwereequalforaconsecutivesequenceofoneormorebarsimmediatelyprecedingthecurrentbarandthevalueofAwasmorethanthevalueofBonthebarimmediatelyprecedingthissequenceofbars.

Usage

E1CrossDirectionE2

or:

137

Plot1CrossDirectionPlot2

Where:E-anumericalexpressionDirection-arequiredparameter;specifiesthedirectionofthecross

Example

TriggeranalertonthebarwheretheClosepricecrossesabove1350.00:

Plot1(Close);IfPlot1CrossAbove1350.50ThenAlert("Pricehascrossedabove1350.00");

138

CrossesSameasCross

139

DownToUsedincombinationwithFortoformaloopstatementthatwillexecuteasetofinstructionsrepeatedlyuntiltheloopcountreachesthespecifiedfinalvalue.

DownTospecifiesthatthevalueofthecountervariableistobedecreasedbyoneonthecompletionofeachloop.

FormoreinformationseeFor.

Usage

ForCounter=IValueDownToFValueBeginI1;I2;

End;

Where:Counter-anumericalvariableusedstoretheloopcountIValue-anumericalexpressionspecifyingtheinitialcountervalueFValue-anumericalexpressionspecifyingthefinalcountervalue

Example

Addthehighpricesofthelast10barstotheHighPriceSumvariable:

ForBarBackNo=9DownTo0BeginHighPriceSum=HighPriceSum+High[BarBackNo];End;

140

ElseUsedincombinationwithIfandThentoformaconditionalstatementthatexecutesspecificinstructionsifalogicalexpressionisfalse.

TheconditionalexecutionstatementmustcontainbothIfandTheninadditiontoElse.

FormoreinformationseeIf.

Usage

IfEThenI1ElseI2

Where:E-atrue/falseexpressionI-conditionalinstructions

Example

IfUpTrendistruethenbuyandifUpTrendisfalsethensellshort:

IfUpTrendThenBuyNextBarMarketElseSellShortNextBarMarket;

141

EndUsedincombinationwithBegintogroupinstructionsforconditionalexecution;anEndmustalwaysbeprecededbyaBegin.BeginandEndcanbeusedwithThen,Else,For,andWhileconditionalstatements.

OnlythelastinstanceofEndwithinthesameconditionalexecutionstatementshouldbefollowedbyasemicolon(;).

Usage

CSBeginI1;I2;

I3;

End;

Where:CS-conditionalstatementI-conditionalinstructions

Example

IfUpTrendistruethenbuy,otherwisesellshort:

IfUpTrendThenBeginBuyNextBarMarket;End

ElseBegin

SellShortNextBarMarket;End;

142

FalseAlogical(Boolean)value.Logicalvaluesareusedinlogical(Boolean)expressionsandfortrue/falseinputs.

Usage

False

Example

FalseAndTruewillreturnavalueofFalse

2=1willreturnavalueofFalse

DeclareLogicalVarasatrue/falsevariablewiththeinitialvalueoffalse:

Variable:LogicalVar(False);

DeclareOvernightasatrue/falseinputwiththedefaultvalueoffalse:

Input:Overnight(False);

143

ForUsedincombinationwithToorDownTotoformaloopstatementthatwillexecuteasetofinstructionsrepeatedlyuntiltheloopcountreachesthespecifiedfinalvalue.

Theloopstatementspecifiesanumericalvariablethatholdstheloopcount,aswellasinitialandfinalcountervalues.Tospecifiesthatthevalueofthecountervariableistobeincreasedbyoneonthecompletionofeachloop,whileDownTospecifiesthatthevalueofthecountervariableistobedecreasedbyoneonthecompletionofeachloop.

TheuseofBeginandEndstatementsisrequiredtogrouptheinstructionsforexecutionwithintheloop;aBeginmustalwaysbefollowedbyanEnd.

Beginshouldnotbefollowedbyasemicolon(;),codelineswithinaninstructiongroupshouldendwithasemicolon(;),andEndshouldbefollowedbyasemicolon(;).

Usage

ForCounter=IValueToFValueBeginI1;I2;

End;

or:

ForCounter=IValueDownToFValueBeginI1;

I2;

End;

Where:Counter-anumericalvariableusedstoretheloopcountIValue-anumericalexpressionspecifyingtheinitialcountervalueFValue-anumericalexpressionspecifyingthefinalcountervalue

Example

Addthehighpricesofthelast10barstotheHighPriceSumvariable:

ForBarBackNo=0To9Begin

144

HighPriceSum=HighPriceSum+High[BarBackNo];End;

Addthehighpricesofthelast10barstotheHighPriceSumvariable:

ForBarBackNo=9DownTo0BeginHighPriceSum=HighPriceSum+High[BarBackNo];End;

145

IfUsedincombinationwithThentoformaconditionalstatementthatexecutesspecificinstructionsifalogicalexpressionistrue,andwithElsetoformaconditionalstatementthatexecutesspecificinstructionsifalogicalexpressionisfalse.

TheconditionalexecutionstatementmustcontainbothIfandThen;Elseisoptional.

BeginandEndstatementsareusedtogroupinstructionsforconditionalexecution;aBeginmustalwaysbefollowedbyanEnd.

Beginshouldnotbefollowedbyasemicolon(;),codelineswithinaninstructiongroupshouldendwithasemicolon(;),andonlythelastinstanceofEndwithinthesameconditionalexecutionstatementshouldbefollowedbyasemicolon(;).

Usage

IfEThenI1ElseI2

or:

IfEThenBeginI1;I2;

End

ElseBegin

I3;

I4;

End;

Where:E-atrue/falseexpressionI-conditionalinstructions

Example

IfUpTrendisfalsethensell:

IfUpTrend=FalseThenSellNextBarMarket;

IfUpTrendistruethenbuy,otherwisesellshort:

146

IfUpTrendThenBuyNextBarMarketElseSellShortNextBarMarket;

IfUpTrendistruethenbuy,otherwisesellshort:

IfUpTrendThenBeginBuyNextBarMarket;End

ElseBegin

SellShortNextBarMarket;End;

147

NotUsedinTrue/Falsestatements:negative

Example

Condition1=True;

Condition2=NotCondition1;

AssignstoCondition2valueoppositetoCondition1.

148

OrAlogical(Boolean)operatorthatreturnsTrueifoneorbothofitsoperandsaretrue.Logicaloperatorsareusedinlogical(Boolean)expressionsthatoperatewithtrue/falsevalues.

Usage

E1OrE2

Where:E-true/falseexpressions

Example

2=1Or2>2willreturnavalueofFalse

TrueOrFalseOrFalsewillreturnavalueofTrue

149

OverSameasAbove

150

switchPartofswitch-caseoperator.

Usage

Seeinexample

Example

switchgetplotcolor(1)begincasegreen:print("Indicatoringreenzoneonbar",currentbar);casered:print("Indicatorinredzoneonbar",currentbar);casered:print("Indicatorisneutralonbar",currentbar);end;

151

ThenUsedincombinationwithIftoformaconditionalstatementthatexecutesspecificinstructionsifalogicalexpressionistrue.

FormoreinformationseeIf.

Usage

IfEThenI

Where:E-atrue/falseexpressionI-conditionalinstructions

Example

IfUpTrendisfalsethensell:

IfUpTrend=FalseThenSellNextBarMarket;

152

ToUsedincombinationwithFortoformaloopstatementthatwillexecuteasetofinstructionsrepeatedlyuntiltheloopcountreachesthespecifiedfinalvalue.

Tospecifiesthatthevalueofthecountervariableistobeincreasedbyoneonthecompletionofeachloop.

FormoreinformationseeFor.

Usage

ForCounter=IValueToFValueBeginI1;I2;

End;

Where:Counter-anumericalvariableusedstoretheloopcountIValue-anumericalexpressionspecifyingtheinitialcountervalueFValue-anumericalexpressionspecifyingthefinalcountervalue

Example

Addthehighpricesofthelast10barstotheHighPriceSumvariable:

ForBarBackNo=0To9BeginHighPriceSum=HighPriceSum+High[BarBackNo];End;

153

TrueAlogical(Boolean)value.Logicalvaluesareusedinlogical(Boolean)expressionsandfortrue/falseinputs.

Usage

True

Example

TrueOrFalsewillreturnavalueofTrue

2=2willreturnavalueofTrue

DeclareLogicalVarasatrue/falsevariablewiththeinitialvalueoftrue:

Variable:LogicalVar(True);

DeclareOvernightasatrue/falseinputwiththedefaultvalueoftrue:

Input:Overnight(True);

154

UnderSameasBelow

155

WhileUsedincombinationwithBeginandEndtoformaconditionalloopstatementthatwillexecuteasetofinstructionsrepeatedlyaslongasalogicalexpressionistrue.Ifthelogicalexpressionisnottrue,theinstructionswillnotbeexecuted.

BeginandEndstatementsareusedtogroupinstructionsforconditionalexecution;aBeginmustalwaysbefollowedbyanEnd.

Beginshouldnotbefollowedbyasemicolon(;),codelineswithinaninstructiongroupshouldendwithasemicolon(;),andEndshouldbefollowedbyasemicolon(;).

Usage

WhileEBeginI1;I2;

I3;

End;

Where:E-atrue/falseexpressionI-conditionalinstructions

Example

Addthehighpricesofthelast10barstotheHighPriceSumvariable:

BarBackNo=0;WhileBarBackNo<10BeginHighPriceSum=HighPriceSum+High[BarBackNo];BarBackNo=BarBackNo+1;End;

156

AUD

Constantusedtodesignatethecurrency"AustralianDollar".

Usage

AUD

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"AustralianDollar".

condition1=SymbolCurrencyCode=AUD;

157

CAD

Constantusedtodesignatethecurrency"CanadianDollar".

Usage

CAD

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"CanadianDollar".

condition1=SymbolCurrencyCode=CAD;

158

CHF

Constantusedtodesignatethecurrency"SwissFranc".

Usage

CHF

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"SwissFranc".

condition1=SymbolCurrencyCode=CHF;

159

Convert_Currency

ReturnstheSrcMoneysum,setintheSrcCurrencycurrency,intheDstCurrencycurrencyusingthecross-rateattheDateTimedateandtime.

Usage

Convert_Currency(DateTime,SrcCurrency,DstCurrency,SrcMoney);

Where:

DateTime-dateandtimesetintheDateTimeformat

SrcCurrency-initialcurrencyusedforconversion

DstCurrency-currencytowhichthesumwillbeconvertedto

SrcMoney-fundsininitialcurrency(SrcCurrency)tobeconvertedtoDstCurrency

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Convert_Currency(39448.25000000,GBP,USD,12.34);willreturn24.48,whichmeansthat:on1/1/2008:12.34GBPwasequalto24.48USD.

160

EUR

Constantusedtodesignatethecurrency"Euro".

Usage

EUR

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"Euro".

condition1=SymbolCurrencyCode=EUR;

161

GBP

Constantusedtodesignatethecurrency"BritishPound".

Usage

GBP

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"BritishPound".

condition1=SymbolCurrencyCode=GBP;

162

HKD

Constantusedtodesignatethecurrency"HongKongDollar".

Usage

HKD

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"HongKongDollar".

condition1=SymbolCurrencyCode=HKD;

163

JPY

Constantusedtodesignatethecurrency"JapaneseYen".

Usage

JPY

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"JapaneseYen".

condition1=SymbolCurrencyCode=JPY;

164

NOK

Constantusedtodesignatethecurrency"NorwegianKrone".

Usage

NOK

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"NorwegianKrone".

condition1=SymbolCurrencyCode=NOK;

165

None

Constantusedtodesignatethatcurrencywasnotindicated.

Usage

None

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

ChecksifthecurrencyofthesymbolusedforthecalculationisnotindicatedinQuoteManagersettings.

condition1=SymbolCurrencyCode=None;

166

NZD

Constantusedtodesignatethecurrency"NewZealandDollar".

Usage

NZD

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"NewZealandDollar".

condition1=SymbolCurrencyCode=NZD;

167

Portfolio_CurrencyCode

ReturnscurrencycodefromPortfoliosettings(View->PortfolioSettings)

Usage

Portfolio_CurrencyCode

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

ChecksifthecurrencyofportfolioaccountusedforcalculationisUSDollar.

condition1=Portfolio_CurrencyCode=USD;

168

SEK

Constantusedtodesignatethecurrency"SwedishKrona".

Usage

SEK

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"SwedishKrona".

condition1=SymbolCurrencyCode=SEK;

169

SGD

Constantusedtodesignatethecurrency"SingaporeDollar".

Usage

SGD

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"SingaporeDollar".

condition1=SymbolCurrencyCode=SGD;

170

SymbolCurrencyCode

ReturnscurrencycodefromQuoteManagersymbolsettings(EditSymbol...->Settings->Currency)

Usage

SymbolCurrencyCode

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

ChecksifthecurrencyofthesymbolusedforcalculationisUSDollar.

condition1=SymbolCurrencyCode=USD;

171

TRY_

Constantusedtodesignatethecurrency"TurkishLira".

Usage

TRY_

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"TurkishLira".

condition1=SymbolCurrencyCode=TRY_;

172

USD

Constantusedtodesignatethecurrency"USDollar".

Usage

USD

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"USDollar".

condition1=SymbolCurrencyCode=USD;

173

ZAR

Constantusedtodesignatethecurrency"SouthAfricanRand".

Usage

ZAR

Notes

Thebase14currenciescanbedesignatedbyconstants.

Example

Checksifthecurrencyofthesymbolusedforthecalculationis"SouthAfricanRand".

condition1=SymbolCurrencyCode=ZAR;

174

AgoUsedincombinationwithBarorBarsandanumericalexpressiontoreferencethebaraspecifiednumberofbarsbackfromthecurrentbar.

BarsAgocanalsobespecifiedbyusingthebaroffsetnotationthatconsistsofanumericalexpressionenclosedinsquarebrackets.

Usage

NBarsAgo

or:

[N]

Where:N-anumericalexpressionspecifyingthenumberofbarsbacktoreference

Example

Plottheclosingpriceofthepreviousbar:

Plot1(CloseOf1BarAgo,"Previousbar'sclose");

Plottheclosingpriceoftwobarsago:

Plot1(Close[2],"Close2barsago");

175

BarUsedincombinationwithThis,Next,orAgotoreferenceaspecificbar.

Usage

Bar

Example

CloseOf1BarAgowillreturntheclosingpriceofthepreviousbar

Buyauser-setnumberofsharesoncloseofthisbar:

BuyThisBarOnClose;

Buyauser-setnumberofsharesonopenofnextbar:

BuyNextBarOnOpen;

176

BarInterval

Returnsanumericalvalue,indicatingthenumberofresolutionunits(barinterval)ofthedataseriesthatthestudyisappliedto.

ReturnsthenumberofTicks,Contracts,Points,Changes,Seconds,Minutes,Hours,Days,Weeks,Months,Quarters,orYears,dependingonthechartresolution;avalueof5willbereturnedfora5-secondaswellasfora5-tickchart.

Usage

BarInterval

Example

Assignavalue,indicatingthenumberofresolutionunits(barinterval)ofthedataseriesthatthestudyisappliedto,toValue1variable:

Value1=BarInterval;

177

BarsSameasBar

178

BarStatusReturnsanumericalvalue,indicatingthestatusofthemostrecenttickinthecurrentbarofthespecifieddataseries.

Avalueof0indicatesthatthetickistheopeningtickofthebar,1indicatesthatthetickiswithinthebar,and2indicatesthatthetickistheclosingtickofthebar.

Usage

BarStatus(DataNum)

Where:DataNum-anumericalexpressionspecifyingthedatanumberoftheseries

IfDataNumisnotspecified,avalueforthecurrentdataserieswillbereturned.

Example

BarStatus(1)willreturnavalueof2ifthecurrenttickinthedataserieswiththedatanumber1istheclosingtickofabar

179

BarType

Returnsanumericalvalue,indicatingtheresolutionunitsofthedataseriesthatthestudyisappliedto.

Usage

BarTypeThefollowingvaluesarereturnedforeachtypeofresolutionunits:

0Ticks(Ticks&Contracts)1Intra-Day(Seconds,Minutes,&Hours)2Days3Weeks4Months,Quarters,&Years5Points,Changes,Point&Figure6(Reservedforfutureuse)7(Reservedforfutureuse)8Kagi9(Reservedforfutureuse)10LineBreak11(Reservedforfutureuse)12(Reservedforfutureuse)13Renko256-HeikinAshi

Example

Assignavalue,indicatingtheresolutionunitsofthedataseriesthatthestudyisappliedto,toValue1variable:

Value1=BarType;

180

BarType_ex

AnextendedversionofBarType.Indicatestheresolutionunitsmorespecifically.

Returnsanumericalvalue,indicatingtheresolutionunitsofthedataseriesthatthestudyisappliedto.

Usage

BarType_exThefollowingvaluesarereturnedforeachtypeofresolutionunits:

1Ticks2Minutes3Hours4Days5Weeks6Months7Years8Volume9Seconds10Quarters11Points12Change13Points(Original)14-Point&Figure15-Kagi16-LineBreak17-Renko18-HeikinAshi

Example

Assignavalue,indicatingtheresolutionunitsofthedataseriesthatthestudyisappliedto,toValue1variable:

Value1=BarType_ex;

181

182

BigPointValueReturnsanumericalvalue,indicatingthecurrencyvalueofasinglewholeunitpricechangeforthedataseriesthatthestudyisappliedto.

Usage

BigPointValue

Notes

BigPointValue=PointValue×PriceScale

Example

BigPointValuewillreturn1forGoogle

BigPointValuewillreturn50forE-miniS&P;500

183

BoxSize

Returnstheprice-basedintervalsettingassociatedwiththespecifiedprice-basedcharttypeanindicatororsignalisappliedto.

ThisvalueissetintheChartTypesectionoftheSettingstabwithintheFormatInstrumentdialogforachart.

Usage

BoxSize

Parameters

ChartType ValueReturnedPoint&Figure BoxSizevaluePoint PointvalueRenko BoxSizevalue

Example

Boxsizewillreturnavalueof3forRenkochartwiththeBoxSizeequal3.

Boxsizewillreturnavalueof0forKagiorregularresolutionscharts.

184

CSameasClose

185

Call

ConstantusedtodesignatetheCalloptioninstrument.

Usage

Call

Notes

ThePutoptionscouldbedesignatedbythePutconstant.

Example

ChecksifthesymbolusedforthecalculationisaCalloption.

condition1=OptionType=Call;

186

Category

Returnsanumericalvalue,indicatingthecategory(financialinstrumenttype)ofthesymbolthatstudyisappliedto.

Usage

Category

Thefollowingvaluesarereturnedforeachcategory:

0Future1FutureOption2Stock3StockOption4Index5CurrencyOption6MutualFund7MoneyMarketFund8IndexOption9Cash10Bond11Spread12Forex14Composite

Example

Assignavalue,indicatingthetypeofsymbolthatthestudyisappliedto,toValue1variable:

Value1=Category;

187

CloseReturnstheclosingprice.

Usage

Close

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Example

Plottheclosingpriceofthecurrentbar:

Plot1(Close,"Close");

Plottheclosingpriceofthepreviousbar:

Plot1(CloseOf1BarAgo,"Previousbar'sclose");

Plottheclosingpriceoftwobarsago:

Plot1(Close[2],"Close2barsago");

188

CurrentBarReturnsthenumberofthecurrentbar.

Eachbar,subsequenttotheinitialnumberofbarsspecifiedbytheMaximumBarsBacksetting,isassignedasequentialnumber;theinitialbarsspecifiedbythesettingarenotnumbered.

Forexample,ifMaximumBarsBackissetto20,the21stbarwillbeassignedanumberof1.

Usage

CurrentBar

Example

CurrentBarwillreturnthenumberofthecurrentbar

189

DSameasDate

190

DailyLimitRetainedforbackwardcompatibility.

191

DataUsedtospecifyaparticulardataseriesinamulti-symbolchart;eachdataseriesinamulti-symbolcharthasauniqueDataNumber.

Usage

DataN

Where:N-theDataNumberofthedataseries

Or:

Data(N)

Where:N-anumericalexpressionspecifyingtheDataNumberofthedataseries

Example

HighOfData2willreturnthehighpriceofabarinthedataserieswiththeDataNumberof2

HighOfData(2)willreturnthehighpriceofabarinthedataserieswiththeDataNumberof2

192

DataCompressionSameasBarType

193

Date

Returnsanumericalvalueindicatingtheclosingdateofabar.ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Usage

Date

Example

Datewillreturnavalueof1071030forOctober30th,2007

Datewillreturnavalueof990402forApril2th,1999

194

DateTime

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

DateTimeisadouble-precisiondecimalvalue.Itallowsaccessingmillisecondtimestampsofthebar.

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Usage

DateTime

Example

DateTimewillreturn41422.74for5/28/201308:41:11.813

195

DateTimebarupdate

ReturnstimeofthelastupdateofthecurrentbarifBarMagnifiermodeison.

IfBarMagnifiermodeisoff,returnsthetimeofthecurrentbar(astheTimeproperty).

Usage

datetime_bar_update(data_stream)

Example

BarMagnifiermodeison.Timeanddateofthelastupdateofthecurrentbarare29.04.201310:53:59.154

print(datetime_bar_update:15:8)willreturn41393.45415687.

print(datetimetostring_ms(datetime_bar_update))willreturn"29.04.201310:53:59.154".

196

DayRetainedforbackwardcompatibility;replacedwithBar.

197

DaysRetainedforbackwardcompatibility;replacedwithBar.

198

DownTicksReturnsthetotalnumberofDownticksforthecurrentbarifBuildVolumeOnissettoTickCount.

ReturnsthetotalDownvolumeforthecurrentbarifBuildVolumeOnissettoTradeVolume.

Adowntickisatickwiththepricelowerthentheprecedingtick,anddownvolumeisthevolumetradedondownticks.

WithBuildVolumeOnissettoTickCount:

-thevalueof1willbereturnedfor1-tickcharts-thetotalnumberofDownticksinthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

WithBuildVolumeOnissettoTradeVolume:

-theDownvolumeofthecurrenttickwillbereturnedfor1-tickcharts-thetotalDownvolumeofthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

Pleasenotethatmostdatafeedsprovideonlyalimitedhistoryoftickandvolumedata;storingreal-timefeeddatawillensuretheavailabilityofhistoricaltickandvolumedata.

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Usage

DownTicks

Example

199

PlotthenumberofDownticksinthecurrentbar(BuildVolumeOnissettoTickCount):

Plot1(DownTicks,"DownTicks");

PlottheDownvolumeofthecurrentbar(BuildVolumeOnissettoTradeVolume):

Plot1(DownTicks,"DownVolume");

200

ExpirationDate

Returnsanumericalvalue,indicatingtheexpirationdateofthefinancialinstrumentthestudyisappliedto.ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Forexample,thevaluereturnedforthedateofOctober30th,2008willbe1081030,andforApril2nd,1999willbe990402.

Usage

ExpirationDate

Avalidexpirationdatewillbereturnedforfuturesoroptionsonly.

Example

ExpirationDatewillreturnavalueof1081030forOctober30th,2008

ExpirationDatewillreturnavalueof990402forApril2nd,1999

201

ExpirationDateFromVendor

Returnsanumericalvalue,indicatingtheexpirationdateofthefinancialinstrumentthestudyisappliedto.ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Forexample,thevaluereturnedforthedateofOctober30th,2008willbe1081030,andforApril2nd,1999willbe990402.

Usage

ExpirationDateFromVendor

Avalidexpirationdatewillbereturnedforfuturesoroptionsonly.

Example

ExpirationDateFromVendorwillreturnavalueof1081030forOctober30th,2008

ExpirationDateFromVendorwillreturnavalueof990402forApril2nd,1999

202

GetExchangeNameReturnsastringexpressioncontainingtheexchangenameforthesymbolthatthestudyisappliedto.

Usage

GetExchangeName

Example

GetExchangeNamewillreturn"NASD"forGoogle

GetExchangeNamewillreturn"CME"forE-miniS&P;500

203

GetRTSymbolNameReturnsastringexpressioncontainingthenameofthereal-timesymbolthatthestudyisappliedtoincasethemergingoptionisenabled.IfthemergingoptionisdisabledreturnsthesamevalueastheNameproperty.Incaseofacustomfuturesinstrumentthenameofthelastcontractisreturned.

Usage

GetRTSymbolName

Example

GetRTSymbolNamewillreturn"GOOG"forGoogleifthemergingoptionisenabledandGoogleisconfiguredasthereal-timeinstrument.

204

GetSymbolNameReturnsastringexpressioncontainingthenameofthesymbolthatthestudyisappliedto.

Usage

GetSymbolName

Example

GetSymbolNamewillreturn"GOOG"forGoogle

205

HSameasHigh

206

HighReturnsthehighprice.

Usage

High

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Example

Plotthehighpriceofthecurrentbar:

Plot1(High,"High");

Plotthehighpriceofthepreviousbar:

Plot1(HighOf1BarAgo,"Previousbar'shigh");

Plotthehighpriceoftwobarsago:

Plot1(High[2],"High2Barsago");

207

ISameasOpenInt

208

IntervalType

Returnsanumericalvalue,indicatingtheresolutionintervalsofthedataseriesthatthestudyisappliedto.

Usage

IntervalType

Thefollowingvaluesarereturnedforeachtypeofresolutionunits:

0-Ticks(Ticks&Contracts)1-Intra-Day(Seconds,Minutes,&Hours)2-Days3-Weeks4-Months,Quarters,Years5-Points,Changes0-4-Point&Figure0-4-Kagi0-4-LineBreak0-Renko

Example

Toassignavalue,indicatingtheresolutionunitsofthedataseriesthestudyisappliedto,toValue1variable:

Value1=IntervalType;

209

IntervalType_ex

AnextendedversionofIntervalType.

Indicatestheresolutionintervalsmorespecifically.

Returnsanumericalvalue,indicatingtheresolutionintervalsofthedataseriesthatthestudyisappliedto.

Usage

IntervalType_ex

Thefollowingvaluesarereturnedforeachtypeofresolutionunits:

1-Ticks2-Minutes3-Hours4-Days5-Weeks6-Months7-Years8-Volume9-Seconds10-Quarters11-Points12-Change13-Points(original)1-7,9,10-Point&Figure1-7,9,10-Kagi1-7,9,10-LineBreak1-Renko

Example

Toassignavalue,indicatingtheresolutionunitsofthedataseriesthestudyisappliedto,toValue1variable:

210

Value1=IntervalType_ex;

211

LSameasLow

212

LowReturnsthelowprice.

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Usage

Low

Example

Plotthelowpriceofthecurrentbar:

Plot1(Low,"Low");

Plotthelowpriceofthepreviousbar:

Plot1(LowOf1BarAgo,"Previousbar'slow");

Plotthelowpriceoftwobarsago:

Plot1(Low[2],"Low2barsago");

213

MinMoveReturnsanumericalvalue,indicatingtheminimumfractionalunitpricechangeforthedataseriesthatthestudyisappliedto.

Usage

MinMove

Example

MinMovewillreturn1forGoogle

MinMovewillreturn25forE-miniS&P;500

MinMove*PointValuewillreturnthecurrencyvalue,correspondingtotheminimumpricemoveofashareorcontract

214

NextUsedincombinationwithBartoreferencethenextbar.

Usage

NextBar

Example

Buyauser-setnumberofsharesatMarketpriceonopenofnextbar:

BuyNextBarAtMarket;

215

OSameasOpen

216

OpenReturnsanumericalvalueindicatingtheopenopenprice.

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Usage

Open

Example

Plottheopenpriceofthecurrentbar:

Plot1(Open,"Open");

Plottheopenpriceofthepreviousbar:

Plot1(OpenOf1BarAgo,"Previousbar'sopen");

Plottheopenpriceoftwobarsago:

Plot1(Open[2],"Open2barsago");

217

OpenIntReturnstheopeninterestofthecurrentbarfortime-basedchartswithresolutionsof1dayormore.

Fortickandvolume-basedchartsandfortime-basedchartswithresolutionsof24hoursorless,OpenIntreturns:

-thevolumetradedonDowntickswillbereturnedifBuildVolumeOnissettoTradeVolume-thenumberofDownticksinthecurrentbarwillbereturnedifBuildVolumeOnissettoTickCount

Usage

OpenInt

Notes

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

OpenIntissupportedfortime-basedchartswithresolutionsof1dayormore.

Mostdatafeedsprovideonlyalimitedhistoryofvolumeandtickdata;storingreal-timefeeddatawillensuretheavailabilityofhistoricalvolumeandtickdata.

Example

Plottheopeninterestofthecurrentbar:

Plot1(OpenInt,"Openinterest");

Plottheopeninterestofthepreviousbar:

Plot1(OpenIntof1BarAgo,"Previousbar'sopeninterest");

218

Plottheopeninterestoftwobarsago:

Plot1(OpenInt[2],"Openinterest2barsago");

219

OptionTypeReturnsthenumericalvalue,indicatingthePutorCallvalueforthedataseriesthatthestudyisappliedto.Iftheinstrumentisnotanoptioncontractthekeywordreturns0.

Usage

OptionType

Example

OptionTypewillreturn0forGoogle,sinceitisnotanoptioninstrument

OptionTypewillreturnthevalueofthePutconstantforanyPutoption,andthevalueoftheCallconstantforanyCalloption

220

PointReturnsadecimalnumericalvalue,equivalenttoasinglefractionalpriceunitforthedataseriesthatthestudyisappliedto.

Usage

Point

Notes

Point=1/PriceScale

Example

1Pointwillreturn0.01forGoogle

8Pointwillreturn0.08forE-miniS&P;500

8Pointwillreturn0.25forT-BondFutures

221

PointsSameasPoint

222

PointValueReturnsanumericalvalue,indicatingthecurrencyvalueofasinglefractionalunitpricechangeforthedataseriesthatthestudyisappliedto.

Usage

PointValue

Notes

PointValue=BigPointValue/PriceScale

Example

PointValuewillreturn0.01forGoogle

PointValuewillreturn0.50forE-miniS&P;500

223

PriceScaleReturnsanumericalvalue,indicatingthefractionalunitequivalentofasinglewholeunitpricechangeforthedataseriesthatthestudyisappliedto.

Usage

PriceScale

Notes

PriceScale=BigPointValue/PointValue

Example

PriceScalewillreturn100forGoogle

PriceScalewillreturn32forT-BondFutures

224

Put

ConstantusedtodesignatethePutoptioninstrument.

Usage

Put

Notes

TheCalloptionscouldbedesignatedbytheCallconstant.

Example

ChecksifthesymbolusedforthecalculationisaPutoption.

condition1=OptionType=Put;

225

RevSize

ReturnstheReversalofaPoint&Figurechart,theReversalofaKagichart,orthenumberofLineBreaksinaLineBreakchart.

ThisvalueissetintheChartTypesectionoftheSettingstabwithintheFormatInstrumentdialogforachart.

Usage

Notes

Example

RevSizereturns2ifthereversalsizeofaP&F;chartissetto2.

RevSizereturns5ifthenumberoflinebreaksforaLineBreakchartissetto5.

RevSizereturns4ifthereversalsizeofaKagichartissetto4%.

226

ScrollToBarCentersthechartonthespecifiedbar.

Usage

ScrollToBar(intDataN,intBarN)

Where:DataN-dataseriesnumber

BarN-barnumber

Example

ScrollToBar(2,98);

Willcenterthechartonthe98thbaroftheseconddataseries.

227

SessionLastBar

Returnsalogicalvalueindicatingwhetherthecurrentbaristhelastbarofthesession;returnsavalueofTrueifthecurrentbaristhelastbarofthesession,andavalueofFalseifthecurrentbarisnotthelastbarofthesession.

Usage

SessionLastBar

Example

Assignatrue/falsevalue,indicatingwhetherthecurrentbaristhelastbaronthechart,toLastBarvariable:

Variable:LastBar(False);LastBar=SessionLastBar;

228

StrikeReturnsthenumericalvalue,indicatingthestrikepriceforthedataseriesthatthestudyisappliedto.Iftheinstrumentisnotanoptioncontractthekeywordreturns0.

Usage

Strike

Example

Strikewillreturn0forGoogle,sinceitisnotanoptioninstrument

Strikewillreturn65fortheJanuary2012PutoptionforJohnson&Johnson(JNJ)atthestrikepriceis$65(JNJ120121P00065000)

229

Symbol_Close

Returnstheclosingpriceofthebar.

Usage

Symbol_Close

Note

TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Plottheclosingpriceofthecurrentbar:

Plot1(Symbol_Close,"Close");

Plottheclosingpriceofthepreviousbar:

Plot1(Symbol_Closeof1BarAgo,"PreviousBar'sClose");

Plottheclosingpriceoftwobarsago:

Plot1(Symbol_Close[2],"Close2barsago");

230

Symbol_CurrentBar

ReturnsanumericalvalueindicatingthenumberofthecurrentbarplusMaximumBarsBacksettingforthestudy.

Usage

Symbol_CurrentBar

Note

Eachbar,subsequenttotheinitialnumberofbarsspecifiedbytheMaximumBarsBacksetting,isassignedasequentialnumber;theinitialbarsspecifiedbythesettingarenotnumbered.

Forexample,ifMaximumBarsBackissetto20,the21stbarwillbeassignedanumberof1.

Example

Symbol_CurrentBar

WillreturnthenumberofthecurrentbarplusMaximumBarsBacksettingforthestudy.

231

Symbol_Date

Returnsanumericalvalueindicatingtheclosingdateofabar.ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

Symbol_Date

Note

TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Symbol_Datewillreturnavalueof1071030forOctober30th,2007

Symbol_Datewillreturnavalueof990402forApril2th,1999

232

Symbol_DownTicks

ReturnsthetotalnumberofDownticksforthecurrentbarifBuildVolumeOnissettoTickCount.

ReturnsthetotalDownvolumeforthecurrentbarifBuildVolumeOnissettoTradeVolume.

Adowntickisatickwiththepricelowerthantheprecedingtick,anddownvolumeisthevolumetradedondownticks.

WithBuildVolumeOnissettoTickCount:

-thevalueof1willbereturnedfor1-tickcharts-thetotalnumberofDownticksinthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

WithBuildVolumeOnissettoTradeVolume:

-theDownvolumeofthecurrenttickwillbereturnedfor1-tickcharts-thetotalDownvolumeofthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

Usage

Symbol_DownTicks

Note

Mostdatafeedsprovideonlyalimitedhistoryoftickandvolumedata;storingreal-timefeeddatawillensuretheavailabilityofhistoricaltickandvolumedataTherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

233

PlotthenumberofDownticksinthecurrentbar(BuildVolumeOnissettoTickCount):

Plot1(Symbol_DownTicks,"DownTicks");

PlottheDownvolumeofthecurrentbar(BuildVolumeOnissettoTradeVolume):

Plot1(Symbol_DownTicks,"DownVolume");

234

Symbol_High

Returnsthehighpriceofthebar

Usage

Symbol_High

Note

TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Plotthehighpriceofthecurrentbar:

Plot1(Symbol_High,"High");

Plotthehighpriceofthepreviousbar:

Plot1(Symbol_Highof1BarAgo,"PreviousBar'shigh");

Plotthehighpriceoftwobarsago:

Plot1(Symbol_High[2],"High2BarsAgo");

235

Symbol_Length

Returnsanumericalvalueindicatingtheactualnumberofbarsofadataseriesonchart.

Usage

Symbol_Length

Note

Iftheseriesisnotupdatinginreal-time(nonewbarsappear),thekeywordreturnsthesamevalueoneachcalculation.Ifthechartupdatesinreal-timethekeywordreturnsthenumberofbarsavailablebythemomentscriptreferencesthekeyword.Itmeansthatthekeywordpossiblycanreturndifferentvaluesevenduringcalculationwithinthesamebar.

Example

Plot1(Symbol_Length,"Lengthofseries");

Plotsavalueof500ifthenumberofbarsofdataseriesis500andthereisnonewbarsappearPlotsavalueof501ifthenumberofbarsofdataseriesbecomes501becausenewbarappeared

236

Symbol_Low

Returnsthelowpriceofthebar

Usage

Symbol_Low

Note

TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Plotthelowpriceofthecurrentbar

Plot1(Symbol_Low,"Low");

Plotthelowpriceofthepreviousbar:

Plot1(Symbol_Lowof1BarAgo,"PreviousBar'slow");

Plotthelowpriceoftwobarsago:

Plot1(Symbol_Low[2],"Low2barsago");

237

Symbol_Open

Returnsanumericalvalueindicatingtheopenpriceofthebar.

Usage

Symbol_Open

Note

TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Plottheopenpriceofthecurrentbar:

Plot1(Symbol_Open,"Open");

Plottheopenpriceofthepreviousbar:

Plot1(Symbol_Openof1BarAgo,"Previousbar'sopen");

Plottheopenpriceoftwobarsago:

Plot1(Symbol_Open[2],"Open2barsago");

238

Symbol_OpenInt

Returnstheopeninterestofthecurrentbarfortickandvolume-basedcharts,andfortime-basedchartswithresolutionsof24hoursorless:

-thevolumetradedonDowntickswillbereturnedifBuildVolumeOnissettoTradeVolume-thenumberofDownticksinthecurrentbarwillbereturnedifBuildVolumeOnissettoTickCount

OpenIntissupportedfortime-basedchartswithresolutionsof1dayormore.

Usage

Symbol_OpenInt

Note

Mostdatafeedsprovideonlyalimitedhistoryofvolumeandtickdata;storingreal-timefeeddatawillensuretheavailabilityofhistoricalvolumeandtickdata.TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Plottheopeninterestofthecurrentbar:

Plot1(Symbol_OpenInt,"OpenInterest");

Plottheopeninterestofthepreviousbar:

Plot1(Symbol_OpenIntof1BarAgo,"PreviousBar'sOpenInterest");

Plottheopeninterestoftwobarsago:

Plot1(Symbol_OpenInt[2],"OpenInterest2barsago");

239

240

Symbol_TickIDThiskeywordcanbeusedtodistinguishbetweenthebarswiththesamedateandtimestamps.

Fortickandvolume-basedchartsreturnsthetickindexwithinasecond.Forresolutionshigherthan1Tickreturnstheindexofthelasttickwithinthebar.

Fortime-basedchartswithresolutionsof1secormorenotsupported.Returns0.

Realtimeticksstoredinthedatabasearebeingassignedthelast31bit-theidentifierofrealtimeaffiliation.InordertogettheSymbol_TickIDvaluewithoutrealtimeidentifieroneneedstocalculatetheremainderfromSymbol_TickIDvaluedivisionby2147483648.

value1=Mod(Symbol_TickID,2147483648);

Usage

Symbol_TickID

Note

TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Plotsthetickindex(TickID)ofthelasttickwithinthecurrentbar:

Plot1(Symbol_TickID,"SymTickID");

241

Symbol_Ticks

ReturnsthetotalnumberofticksforthecurrentbarifBuildVolumeOnissettoTickCount.

ReturnsthetotalvolumeforthecurrentbarifBuildVolumeOnissettoTradeVolume.

WithBuildVolumeOnissettoTickCount:

-thevalueof1willbereturnedfor1-tickcharts-thetotalnumberofticksinthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

WithBuildVolumeOnissettoTradeVolume:

-thevolumeofthecurrenttickwillbereturnedfor1-tickcharts-thetotalvolumeofthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

Usage

Symbol_Ticks

Note

Mostdatafeedsprovideonlyalimitedhistoryoftickandvolumedata;storingreal-timefeeddatawillensuretheavailabilityofhistoricaltickandvolumedataTherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Plotthenumberofticksinthecurrentbar(BuildVolumeOnissettoTickCount):

Plot1(Symbol_Ticks,"Ticks");

242

Plotthevolumeofthecurrentbar(BuildVolumeOnissettoTradeVolume):

Plot1(Symbol_Ticks,"Volume");

243

Symbol_Time

Returnsanumericalvalueindicatingtheclosingtimeofthecurrentbar.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

Symbol_Time

Note

TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Symbol_Timewillreturnavalueof1015for10:15AM

Symbol_Timewillreturnavalueof1545for3:45PM

244

Symbol_Time_S

Returnsanumericalvalueindicatingtheclosingtime,includingseconds,ofthecurrentbar.

Thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

Usage

Symbol_Time_S

Note

TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Symbol_Time_Swillreturnavalueof101525for10:15:25AM

Symbol_Time_Swillreturnavalueof154500for3:45:00PM

245

Symbol_UpTicks

ReturnsthetotalnumberofUpticksforthecurrentbarifBuildVolumeOnissettoTickCount.

ReturnsthetotalUpvolumeforthecurrentbarifBuildVolumeOnissettoTradeVolume.

Anuptickisatickwiththepricehigherthentheprecedingtick,andupvolumeisthevolumetradedonupticks.

WithBuildVolumeOnissettoTickCount:

-thevalueof1willbereturnedfor1-tickcharts-thetotalnumberofUpticksinthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

WithBuildVolumeOnissettoTradeVolume:

-theUpvolumeofthecurrenttickwillbereturnedfor1-tickcharts-thetotalUpvolumeofthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

Usage

Symbol_UpTicks

Note

Mostdatafeedsprovideonlyalimitedhistoryoftickandvolumedata;storingreal-timefeeddatawillensuretheavailabilityofhistoricaltickandvolumedataTherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

246

PlotthenumberofUpticksinthecurrentbar(BuildVolumeOnissettoTickCount):

Plot1(Symbol_UpTicks,"UpTicks");

PlottheUpvolumeofthecurrentbar(BuildVolumeOnissettoTradeVolume):

Plot1(Symbol_UpTicks,"UpVolume");

247

Symbol_Volume

Returnsthevolumeofthecurrentbar.

Fortickandvolume-basedcharts,andtime-basedchartswithresolutionsof24hoursorless:

-thevolumetradedonUptickswillbereturnedifBuildVolumeOnissettoTradeVolume-thenumberofUpticksinthecurrentbarwillbereturnedifBuildVolumeOnissettoTickCount

Fortime-basedchartswithresolutionsof1dayormore:

-thetotalvolumetradedwillbereturnedifBuildVolumeOnissettoTradeVolume-thetotalnumberofticksinthecurrentbarwillbereturnedifBuildVolumeOnissettoTickCount

Usage

Symbol_Volume

Note

Mostdatafeedsprovideonlyalimitedhistoryofvolumeandtickdata;storingreal-timefeeddatawillensuretheavailabilityofhistoricalvolumeandtickdata.TherangeofreturnedvaluesisnotlimitedbytheMaxBarsBacksetting.Thiskeywordcanreturnthevalueofanybarofthedataseries.

Example

Plotthevolumeofthecurrentbar

Plot1(Symbol_Volume,"Volume");

248

Plotthevolumeofthepreviousbar:

Plot1(Symbol_Volumeof1BarAgo,"PreviousBar'sVolume");

Plotthevolumeoftwobarsago:

Plot1(Symbol_Volume[2],"Volume2barsago");

249

TSameasTime

250

ThisUsedincombinationwithBartoreferencethecurrentbar.

Usage

ThisBar

Example

Buyauser-setnumberofsharesoncloseofthisbar:

BuyThisBarOnClose;

251

TickIDThiskeywordcanbeusedtodistinguishbetweenthebarswiththesamedateandtimestamps.

Fortickandvolume-basedchartsreturnsthetickindexwithinasecond.Forresolutionshigherthan1Tickreturnstheindexofthelasttickwithinthebar.

Fortime-basedchartswithresolutionsof1secormorenotsupported.Returns0.

Realtimeticksstoredinthedatabasearebeingassignedthelast31bit-theidentifierofrealtimeaffiliation.InordertogettheTickIDvaluewithoutrealtimeidentifieroneneedstocalculatetheremainderfromTickIDvaluedivisionby2147483648.

value1=Mod(TickID,2147483648);

Usage

TickID

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Example

Plotsthetickindex(TickID)ofthelasttickwithinthecurrentbar:

Plot1(TickID,"TickID");

252

TicksReturnsthetotalnumberofticksforthecurrentbarifBuildVolumeOnissettoTickCount.

ReturnsthetotalvolumeforthecurrentbarifBuildVolumeOnissettoTradeVolume.

WithBuildVolumeOnissettoTickCount:

-thevalueof1willbereturnedfor1-tickcharts-thetotalnumberofticksinthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

WithBuildVolumeOnissettoTradeVolume:

-thevolumeofthecurrenttickwillbereturnedfor1-tickcharts-thetotalvolumeofthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

Pleasenotethatmostdatafeedsprovideonlyalimitedhistoryoftickandvolumedata;storingreal-timefeeddatawillensuretheavailabilityofhistoricaltickandvolumedata.

Usage

Ticks

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Example

Plotthenumberofticksinthecurrentbar(BuildVolumeOnissettoTickCount):

Plot1(Ticks,"Ticks");

253

Plotthevolumeofthecurrentbar(BuildVolumeOnissettoTradeVolume):

Plot1(Ticks,"Volume");

254

Time

Returnsanumericalvalueindicatingtheclosingtimeofthecurrentbar.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

Time

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Example

Timewillreturnavalueof1015for10:15AM

Timewillreturnavalueof1545for3:45PM

255

Time_s

Returnsanumericalvalueindicatingtheclosingtime,includingseconds,ofthecurrentbar.Thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM.

Usage

Time_s

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Example

Time_swillreturnavalueof101525for10:15:25AM

Time_swillreturnavalueof154500for3:45:00PM

256

TodayRetainedforbackwardcompatibility;replacedwithThisBar

257

UpTicksReturnsthetotalnumberofUpticksforthecurrentbarifBuildVolumeOnissettoTickCount.

ReturnsthetotalUpvolumeforthecurrentbarifBuildVolumeOnissettoTradeVolume.

Anuptickisatickwiththepricehigherthentheprecedingtick,andupvolumeisthevolumetradedonupticks.

Withbuildvolumeonissettotickcount:

-thevalueof1willbereturnedfor1-tickcharts-thetotalnumberofUpticksinthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

Withbuildvolumeonissettotradevolume:

-theUpvolumeofthecurrenttickwillbereturnedfor1-tickcharts-thetotalUpvolumeofthecurrentbarwillbereturnedformulti-tick,volume,andtime-basedcharts

Pleasenotethatmostdatafeedsprovideonlyalimitedhistoryoftickandvolumedata;storingreal-timefeeddatawillensuretheavailabilityofhistoricaltickandvolumedata.

Usage

UpTicks

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Example

PlotthenumberofUpticksinthecurrentbar(BuildVolumeOnissettoTick

258

Count):

Plot1(UpTicks,"UpTicks");

PlottheUpvolumeofthecurrentbar(BuildVolumeOnissettoTradeVolume):

Plot1(UpTicks,"UpVolume");

259

VSameasVolume

260

VolumeReturnsthevolumeofthecurrentbar.

Fortickandvolume-basedcharts,andtime-basedchartswithresolutionsof24hoursorless:

-thevolumetradedonUptickswillbereturnedifBuildVolumeOnissettoTradeVolume-thenumberofUpticksinthecurrentbarwillbereturnedifBuildVolumeOnissettoTickCount

Fortime-basedchartswithresolutionsof1dayormore:

-thetotalvolumetradedwillbereturnedifBuildVolumeOnissettoTradeVolume-thetotalnumberofticksinthecurrentbarwillbereturnedifBuildVolumeOnissettoTickCount

Pleasenotethatmostdatafeedsprovideonlyalimitedhistoryofvolumeandtickdata;storingreal-timefeeddatawillensuretheavailabilityofhistoricalvolumeandtickdata.

Usage

Volume

Note

TherangeofreturnedvaluesislimitedbytheMaxBarsBacksetting.

Example

Plotthevolumeofthecurrentbar:

Plot1(Volume,"Volume");

261

Plotthevolumeofthepreviousbar:

Plot1(VolumeOf1BarAgo,"Previousbar'svolume");

Plotthevolumeoftwobarsago:

Plot1(Volume[2],"Volume2barsago");

262

YesterdayRetainedforbackwardcompatibility.

263

ComputerDateTime

Returnsadouble-precisiondecimalDateTimevalueindicatingthecomputer'scurrentdateandtime.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

ComputerDateTime

Example

ComputerDateTimewillreturnavalueof39448.25000000for6:00AMonJanuary1st,2008

264

CurrentDate

Returnsanumericalvalueindicatingthecomputer'scurrentdate.ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Forexample,thevaluereturnedforthedateofOctober30th,2008willbe1081030.

Usage

CurrentDate

Example

CurrentDatewillreturnavalueof1081030forOctober30th,2008

265

CurrentTime

Returnsanumericalvalue,indicatingthecomputer'scurrenttime.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

CurrentTime

Example

CurrentTimewillreturnavalueof1015for10:15AM

CurrentTimewillreturnavalueof1545for3:45PM

266

CurrentTime_s

Returnsanumericalvalueindicatingthecomputer'scurrenttime,includingseconds.Thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM.

Usage

CurrentTime_s

Example

CurrentTime_swillreturnavalueof101525for10:15:25AM

CurrentTime_swillreturnavalueof154500for3:45:00PM

267

DateTime2ELTime

ReturnsanumericalvalueindicatingthetimefromthespecifiedDateTimevalue.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

DateTime2ELTime(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevalue

Example

DateTime2ELTime(39449.65625000)willreturnavalueof1545,indicating3:45PM

268

DateTime2ELTime_s

Returnsanumericalvalueindicatingthetime,includingseconds,fromthespecifiedDateTimevalue.Thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

DateTime2ELTime_s(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevalue

Example

DateTime2ELTime_s(39449.646354167)willreturnavalueof153045,indicating3:30:45PM

269

DateTimeToString

ReturnsastringexpressioncorrespondingtothespecifiedDateTimevalue.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

DateTimeToString(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevaluetobeconvertedtoastringexpression

Notes

TheoutputexampleisinthedefaultUSregionaldateandtimeformat.DateandtimeformatsarecontrolledbytheRegionalOptionssettingsthatcanbeaccessedfromtheControlPaneloftheWindowsXPoperatingsystem.

Example

DateTimeToString(39448.25000000)willreturnthestring"1/1/20086:00:00AM"

270

DateTimeToString_Ms

Returnsastringvalueindicatingdateandtimeofabarwithmillisecondprecision.

Usage

DateTimeToString_Ms(DT)

Where:DTisDateTimevalue.

Example

DateTimeToString_Ms(DateTime)willreturnastringvaluecorrespondingtothetimeandtimeofthecurrentbar

"5/28/201308:41:11.871".

271

DateToJulian

ReturnsanumericalvaluecorrespondingtotheJulianDateequivalentofthespecifieddate.

ThedateisspecifiedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

JulianDateindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900.

Usage

DateToJulian(YYYMMdd)

Where:YYYMMdd-anumericalexpression,specifyingthedateinYYYMMddformat

Example

DateToJulian(1080101)willreturnavalueof39448,correspondingtothespecifieddateofJanuary1st,2008

DateToJulian(990402)willreturnavalueof36252,correspondingtothespecifieddateofApril2nd,1999

272

DateToString

Returnsastringexpressioncorrespondingtothedate(integer)portionofthespecifiedDateTimevalue.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

DateToString(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevaluetobeconvertedtoastringexpressionrepresentingthedate

Notes

TheoutputexampleisinthedefaultUSregionaldateformat.DateformatiscontrolledbytheRegionalOptionssettingsthatcanbeaccessedfromtheControlPaneloftheWindowsXPoperatingsystem.

Example

DateToString(39448.25000000)willreturnthestring"1/1/2008".

273

DayFromDateTime

ReturnsanumericalvalueindicatingthedayofthemonthforthespecifiedDateTimevalue.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

DayFromDateTime(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevalue

Example

DayFromDateTime(39449.25000000)willreturnavalueof2,indicatingthe2nddayofthemonthofJanuary,2008

274

DayOfMonth

Returnsanumericalvalue,indicatingthedayofthemonthofthespecifieddate.

ThedateisspecifiedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

DayOfMonth(YYYMMdd)

Where:YYYMMdd-anumericalexpression,specifyingthedateinYYYMMddformat

Example

DayOfMonth(1080101)willreturnavalueof1,indicatingthe1stdayofthemonthofJanuary,2008

DayOfMonth(990605)willreturnavalueof5,indicatingthe5thdayofthemonthofJune,1999

275

DayOfWeek

Returnsanumericalvalue,indicatingthedayoftheweekcorrespondingtothespecifieddate,where0=Sunday,1=Monday,etc.

TheDateisspecifiedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

DayOfWeek(YYYMMdd)

Where:YYYMMdd-anumericalexpression,specifyingthedateinYYYMMddformat

Example

DayOfWeek(1080101)willreturnavalueof2,indicatingTuesday,forJanuary1st,2008

DayOfWeek(990603)willreturnavalueof4,indicatingThursday,forJune3rd,1999

276

DayOfWeekFromDateTime

Returnsanumericalvalue,indicatingthedayoftheweekcorrespondingtothespecifiedDateTimevalue,where0=Sunday,1=Monday,etc.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

DayOfWeekFromDateTime(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevalue

Example

DayOfWeekFromDateTime(39448.25000000)willreturnavalueof2,indicatingTuesday,forJanuary1st,2008

277

ELDateToDateTime

Returnstheintegerportionofadouble-precisiondecimalDateTimevaluecorrespondingtothespecifiedELDate.

ELDateisspecifiedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

ELDateToDateTime(YYYMMdd)

Where:YYYMMdd-anumericalexpression,specifyingthedateinELYYYMMddformat

Example

ELDateToDateTime(1080101)willreturnavalueof39448.00000000,correspondingtothespecifieddateofJanuary1st,2008

ELDateToDateTime(990402)willreturnavalueof36252.00000000,correspondingtothespecifieddateofApril2nd,1999

278

ELTimeToDateTime

Returnsthefractionalportionofadouble-precisiondecimalDateTimevaluecorrespondingtothespecifiedtime.Thetimeisspecifiedinthe24-hourHHmmformat,where1300=1:00PM.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

ELTimeToDateTime(HHmm)

Where:HHmm-anumericalexpressionspecifyingthetime

Example

ELTimeToDateTime(1015)willreturnavalueof0.42708333,correspondingtothespecifiedtimeof10:15AM

ELTimeToDateTime(1545)willreturnavalueof0.65625000,correspondingtothespecifiedtimeof3:45PM

279

ELTimeToDateTime_s

Returnsthefractionalportionofadouble-precisiondecimalDateTimevaluecorrespondingtothespecifiedtime,includingseconds.Thetimeisspecifiedinthe24-hourHHmmssformat,where130000=1:00:00PM.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

ELTimeToDateTime_s(HHmmss)

Where:HHmmss-anumericalexpressionspecifyingthetime

Example

ELTimeToDateTime_s(101525)willreturnavalueof0.427372685,correspondingtothespecifiedtimeof10:15:25AM

ELTimeToDateTime_s(154500)willreturnavalueof0.656250000,correspondingtothespecifiedtimeof3:45:00PM

280

El_DateStr

Returnsan8-characternumericalstringcorrespondingtothespecifieddate.ThestringisintheyyyyMMddformat,whereyyyyisthefour-digityear,MMisthemonth,andddisthedayofthemonth.

Usage

El_DateStr(dd,MM,yyyy)

Where:dd-anumericalexpressionspecifyingthedayofthemonthMM-anumericalexpressionspecifyingthemonthyyyy-afour-digitnumericalexpressionspecifyingtheyear

Example

El_DateStr(02,04,2008)willreturnthestring"20080402",correspondingtothespecifieddateofApril2nd,2008.

281

El_DateToDateTimeSameastheElDateToDateTime

282

EL_TimeToDateTimeSameastheElTimeToDateTime

283

EL_TimeToDateTime_sSameasElTimeToDateTime_s

284

EncodeDate

Returnstheintegerportionofadouble-precisiondecimalDateTimevaluecorrespondingtothespecifieddate.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

EncodeDate(yy,MM,dd)

Where:yy-anumericalexpressionspecifyingthetwo-digityearMM-anumericalexpressionspecifyingthemonthdd-anumericalexpressionspecifyingthedayofthemonth

Example

EncodeDate(08,01,01)willreturnavalueof39448.00000000,correspondingtothespecifieddateofJanuary1st,2008

285

EncodeTime

Returnsthefractionalportionofadouble-precisiondecimalDateTimevaluecorrespondingtothespecifiedtime.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

EncodeTime(HH,mm,ss,mmm)

Where:HH-anumericalexpressionspecifyingthehoursin24-hourformatmm-anumericalexpressionspecifyingtheminutesss-anumericalexpressionspecifyingthesecondsmmm-anumericalexpressionspecifyingthemilliseconds

Example

EncodeTime(16,29,55,500)willreturnavalueof0.6874479167,correspondingtothespecifiedtimeof16:29:55.500

286

FormatDate

Returnsaformatedstringexpressioncorrespondingtothedate(integer)portionofthespecifiedDateTimevalue.

Theformatofthestringexpression,includingtheabbreviationsandseparators,isdefinedbythespecifiedformatstring.Theformatstringconsistsofoneormoreelementsarrangedinthedesiredorder.Eachelementrepresentsaparticularpartofthedateinaspecificformat.Spacesandseparatorcharacterstobeusedcanbeinsertedwithintheformatstring.

Usage

FormatDate("FormatString",DateTime)

Parameters

FormatString-aformatstring,specifyingtheformatoftheoutputstringexpressionrepresentingthedate

Thefollowingelementscanbeusedintheformatstring:

d Dayofmonthasdigitswithnoleadingzeroforsingle-digitdaysdd Dayofmonthasdigitswithleadingzeroforsingle-digitdaysddd Dayofweekasathree-letterabbreviationdddd DayofweekasitsfullnameM Monthasdigitswithnoleadingzeroforsingle-digitmonthsMM Monthasdigitswithleadingzeroforsingle-digitmonthsMMM Monthasathree-letterabbreviationMMMMMonthasitsfullnamey Yearaslasttwodigits,butwithnoleadingzeroforyearslessthan10yy Yearaslasttwodigits,butwithleadingzeroforyearslessthan10

yyyy Yearrepresentedbyfullfourdigits

DateTime-adouble-precisiondecimalDateTimevaluetobeconvertedtoastring

287

expressionrepresentingthedate

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Example

FormatDate("dddd,MMMMdd,yyyy.",39469.250)willreturnthestring"Tuesday,January22,2008."

FormatDate("M/d/y",39469.250)willreturnthestring"1/22/8"

FormatDate("dd-MM-yy",39469.250)willreturnthestring"22-01-08"

FormatDate("Nextdddis:MMMdd",39469.250)willreturnthestring"NextTueis:Jan22"

288

FormatTime

Returnsaformatedstringexpressioncorrespondingtothetime(fractional)portionofthespecifiedDateTimevalue.

Theformatofthestringexpression,includingseparators,isdefinedbythespecifiedformatstring.Theformatstringconsistsofoneormoreelementsarrangedinthedesiredorder.Eachelementrepresentsaparticularunitoftimeinaspecificformat.Spacesandseparatorcharacterstobeusedcanbeinsertedwithintheformatstring.

Usage

FormatTime("FormatString",DateTime)

Parameters

FormatString-aformatstring,specifyingtheformatoftheoutputstringexpressionrepresentingthetime

Thefollowingelementscanbeusedintheformatstring:

h Hoursin12-hourAM/PMformatwithnoleadingzeroforsingle-digithourshh Hoursin12-hourAM/PMformatwithleadingzeroforsingle-digithoursH Hoursin24-hourformatwithnoleadingzeroforsingle-digithoursHH Hoursin24-hourformatwithleadingzeroforsingle-digithoursm Minuteswithnoleadingzeroforsingle-digitminutesmmMinuteswithleadingzeroforsingle-digitminutess Secondswithnoleadingzeroforsingle-digitsecondsss Secondswithleadingzeroforsingle-digitsecondst OnecharacterAM/PMdesignatortt MulticharacterAM/PMdesignator

DateTime-adouble-precisiondecimalDateTimevaluetobeconvertedtoastringexpressionrepresentingthetime

289

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Example

FormatTime("hh:mm:sst",39469.6674)willreturnthestring"04:01:03P"

FormatTime("htt",39469.6674)willreturnthestring"4PM"

FormatTime("HH:mm",39469.6674)willreturnthestring"16:01"

FormatTime("mMINsSEC",39469.6674)willreturnthestring"1MIN3SEC"

290

Friday

Returnsanumericalvalueof5,correspondingtoFriday.

Usage

Friday

Example

Fridaywillreturnavalueof5

291

HoursFromDateTime

ReturnsanumericalvalueindicatingthehoursfromthespecifiedDateTimevalue.Thehoursareindicatedinthe24-hourformat,where13=1PM.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

HoursFromDateTime(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevalue

Example

HoursFromDateTime(39449.85000000)willreturnavalueof20,indicating8PM

292

IncMonth

ReturnsanumericalvaluecorrespondingtoaJuliandatethatisafterorbeforethespecifiedJuliandatebyaspecifiednumberofcalendarmonths.

JulianDateindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900.

Usage

IncMonth(JulianDate,M)

Where:JulianDate-anumericalexpressionspecifyingtheJulianDateM-anumericalexpressionspecifyingthenumberofcalendarmonthsfromthespecifiedJuliandate;ifthevalueofMis;positive,adateafterthespecifieddatewillbereturned;ifthevalueofMis;negative,adatebeforethespecifieddatewillbereturned

Example

IncMonth(39417,1)willreturnavalueof39448,correspondingtoJanuary1st,2008,onecalendarmonthafterthespecifieddateofDecember1st,2007

IncMonth(36252,-2)willreturnavalueof36193,correspondingtoFebruary2nd,1999,twocalendarmonthsbeforethespecifieddateofApril2nd,1999

293

JulianToDate

ReturnsanumericalvaluecorrespondingtotheELDateequivalentofthespecifiedJulianDate.

JulianDateindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900.

ELDateisintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

JulianToDate(JulianDate)

Where:JulianDate-anumericalexpressionspecifyingtheJulianDate

Example

JulianToDate(39448)willreturnavalueof1080101,correspondingtothespecifieddateofJanuary1st,2008

JulianToDate(36252)willreturnavalueof990402,correspondingtothespecifieddateofApril2nd,1999

294

LastCalcDateTime

ReturnsanumericalvalueindicatingtheclosingDateTimeofthelastcompletedbar.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

LastCalcDateTime

Example

LastCalcDateTimewillreturnavalueof41871.83333forthelastbarcompletionat08/20/20148:00PM

295

LastCalcJDate

ReturnsanumericalvalueindicatingtheJuliandateforthelastcompletedbar.

JulianDateindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900.

Usage

LastCalcJDate

Example

LastCalcJDatewillreturnavalueof39448forthelastbarcompletiondateofJanuary1st,2008

296

LastCalcMMTime

Returnsanumericalvalueindicatingtheclosingtimeofthelastcompletedbar.Thetimeisindicatedasthenumberofminutesthathavepassedsincemidnight.

Usage

LastCalcMMTime

Example

LastCalcMMTimewillreturnavalueof850forthelastbarcompletiontimeof2:10PM

297

LastCalcmSTime

Returnsanumericalvalueindicatingtheclosingtimeofthelastcompletedbar.Thetimeisindicatedasthenumberofmillisecondsthathavepassedsincemidnight.

Usage

LastCalcmSTime

Example

LastCalcmSTimewillreturnavalueof51030150forthelastbarcompletiontimeof2:10:30.150PM

298

LastCalcSSTime

Returnsanumericalvalueindicatingtheclosingtimeofthelastcompletedbar.Thetimeisindicatedasthenumberofsecondsthathavepassedsincemidnight.

Usage

LastCalcSSTime

Example

LastCalcSSTimewillreturnavalueof51030forthelastbarcompletiontimeof2:10:30PM

299

MilliSecondsFromDateTime

ReturnsanumericalexpressionindicatingthemillisecondstampofDateTimevalue.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

MilliSecondsFromDateTime(DT)

Where:DT-isaDateTimevalue.

Example

MillisecondsFromDateTime(DateTtime)willreturn687.00ifthetimestampofthecurrentbaris11:57:07.687

300

MinutesFromDateTime

ReturnsanumericalvalueindicatingtheminutesfromthespecifiedDateTimevalue.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

MinutesFromDateTime(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevalue

Example

MinutesFromDateTime(39449.35000000)willreturnavalueof24,indicating24minutesafter8AM

301

Monday

Returnsanumericalvalueof1,correspondingtoMonday.

Usage

Monday

Example

Mondaywillreturnavalueof1

302

Month

Returnsanumericalvalue,indicatingthemonthofthespecifiedELDate.

ELDateisspecifiedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

Month(YYYMMdd)

Where:YYYMMdd-anumericalexpression,specifyingthedateinELYYYMMddformat

Example

Month(1080101)willreturnavalueof1,indicatingthemonthofJanuary

Month(990605)willreturnavalueof6,indicatingthemonthofJune

303

MonthFromDateTime

ReturnsanumericalvalueindicatingthemonthforthespecifiedDateTimevalue.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

MonthFromDateTime(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevalue

Example

MonthFromDateTime(39600.25000000)willreturnavalueof6,indicatingthemonthofJune

304

Saturday

Returnsanumericalvalueof6,correspondingtoSaturday.

Usage

Saturday

Example

Saturdaywillreturnavalueof6

305

SecondsFromDateTime

ReturnsanumericalvalueindicatingthesecondsfromthespecifiedDateTimevalue.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

SecondsFromDateTime(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevalue

Example

SecondsFromDateTime(39449.35440000)willreturnavalueof20,indicating20secondsfrom8:30:20AM

306

StringToDate

Returnstheintegerportionofadouble-precisiondecimalDateTimevalue,correspondingtothespecifieddate.Thedateisspecifiedbyastringexpression"MM/dd/yy"*or"MM/dd/yyyy"*,whereMM*isthemonth,dd*istheday,andyyoryyyyisatwo-digitorfour-digityear.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

StringToDate("MM/dd/yy")

or:

StringToDate("MM/dd/yyyy")

Where:MM-month*dd-dayofthemonth*yy-atwo-digityearyyyy-afour-digityear

Notes

*DescribedusageandexamplesareforthedefaultUSregionaldateformat.IfthedefaultUKregionalformatisselected,thedateswillbeindd/MM/yyanddd/MM/yyyyformatinstead.DateformatiscontrolledbytheRegionalOptionssettingsthatcanbeaccessedfromtheControlPaneloftheWindowsXPoperatingsystem.

Example

StringToDate("01/01/2008")willreturnavalueof39448.00000000,correspondingtothespecifieddateofJanuary1st,2008

307

StringToDate("04/04/99")willreturnavalueof36254.00000000,correspondingtothespecifieddateofApril4th,1999

308

StringToDateTime

Returnsadouble-precisiondecimalDateTimevaluecorrespondingtothespecifieddateandtime.Thedateandtimearespecifiedbyastringexpression"MM/dd/yyhh:mm:sstt"*or"MM/dd/yyyyhh:mm:sstt"*,whereMM*isthemonth,dd*istheday,yyoryyyyisatwo-digitorfour-digityear,hhisthehoursin12-hourAM/PMformat,mmistheminutes,ssistheseconds,andttistheAM/PMdesignator.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

StringToDateTime("MM/dd/yyhh:mm:sstt")

or:

StringToDateTime("MM/dd/yyyyhh:mm:sstt")

Where:MM-month*dd-dayofthemonth*yy-atwo-digityearyyyy-afour-digityearhh-hoursmm-minutesss-secondstt-AM/PMdesignator

Notes

*DescribedusageandexamplesareforthedefaultUSregionaldateandtimeformats.IfthedefaultUKregionalformatisselected,thedateswillbeindd/MM/yyanddd/MM/yyyyformatinstead.DateandtimeformatsarecontrolledbytheRegionalOptionssettingsthatcanbeaccessedfromtheControlPaneloftheWindowsXPoperatingsystem.

309

Example

StringToDateTime("01/01/200808:00:00AM")willreturnavalueof39448.33333333,correspondingto08:00:00AMonJanuary1st,2008

StringToDateTime("04/04/9904:48:00PM")willreturnavalueof36254.70000000,correspondingto04:48:00PMonApril4th,1999

310

StringToDTFormatted

ReturnstheDateTimevalueforthestringinaparticularformat.Theformatofthestringexpression,includingtheabbreviationsandseparators,isdefinedbythespecifiedformatstring.Theformatstringconsistsofoneormoreelementsarrangedinthedesiredorder.Eachelementrepresentsaparticularpartofthedateinaspecificformat.Spacesandseparatorcharacterstobeusedcanbeinsertedwithintheformatstring.

Usage

StringToDTFormatted("DateTimeString","FormatString")

Parameters

DateTimeString-timeanddatevalueinstringformat.

FormatString-aformatstring,specifyingtheformatoftheoutputstringexpressionrepresentingthedateandtime.

Thefollowingelementscanbeusedintheformatstring:

d-dayofmonthasdigitswithnoleadingzeroforsingle-digitdaysdd-dayofmonthasdigitswithleadingzeroforsingle-digitdaysddd-dayofweekasathree-letterabbreviationdddd-dayofweekasitsfullnameM-monthasdigitswithnoleadingzeroforsingle-digitmonthsMM-onthasdigitswithleadingzeroforsingle-digitmonthsMMM-monthasathree-letterabbreviationMMMM-monthasitsfullnamey-yearaslasttwodigits,butwithnoleadingzeroforyearslessthan10yy-yearaslasttwodigits,butwithleadingzeroforyearslessthan10yyyy-yearrepresentedbyfullfourdigitsh-hoursin12-hourAM/PMformatwithnoleadingzeroforsingle-digithourshh-hoursin12-hourAM/PMformatwithleadingzeroforsingle-digithoursH-hoursin24-hourformatwithnoleadingzeroforsingle-digithours

311

HH-hoursin24-hourformatwithleadingzeroforsingle-digithoursm-minuteswithnoleadingzeroforsingle-digitminutesmm-minuteswithleadingzeroforsingle-digitminutess-secondswithnoleadingzeroforsingle-digitsecondsss-secondswithleadingzeroforsingle-digitsecondst-onecharacterAM/PMdesignatortt-multicharacterAM/PMdesignator

Returnvalue

DateTime-adouble-precisiondecimalDateTimevalue,correspondingtothefirststringparameterwithasecondstringparameterformatappliedtoit.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Note

Attention!Checkifthereturnedvalueiscorrect!Ifconversionfails,thefunctionreturns-1.

Example

StringToDTFormatted("22/11/201315:35","dd/MM/yyyHH:mm")willreturn41600.649305555555,whichrepresentsNovember22nd2013,3:35PM.

StringToDTFormatted("02/17/11","MM/dd/yy")willreturn40591,whichrepresentsFebruary17th2011.

StringToDTFormatted("17/02/11","MM/dd/yy")willreturn-1,stringconversiontoDateTimeformatfailed.

StringToDTFormatted("4:00PM","h:mmtt")willreturn2.666666666666667,whichrepresentstheminimumvalueofJulianDate=January1st1900,4:00PM.

312

StringToTime

Returnsthefractionalportionofadouble-precisiondecimalDateTimevalue,correspondingtothespecifiedtime.

Thetimeisspecifiedbyastringexpression"hh:mm:sstt",wherehhisthehoursinthe12-hourAM/PMformat,mmistheminutes,ssistheseconds,andttistheAM/PMdesignator.

TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Usage

StringToTime("hh:mm:sstt")

Where:hh-hoursinthe12-hourAM/PMformatmm-minutesss-secondstt-AM/PMdesignator

Notes

DescribedusageandexamplesareforthedefaultUSregionaltimeformat.TimeformatiscontrolledbytheRegionalOptionssettingsthatcanbeaccessedfromtheControlPaneloftheWindowsXPoperatingsystem.

Example

StringToTime("08:00:00AM")willreturnavalueof0.33333333

StringToTime("04:48:00PM")willreturnavalueof0.70000000

313

Sunday

Returnsanumericalvalueof0,correspondingtoSunday.

Usage

Sunday

Example

Sundaywillreturnavalueof0

314

Thursday

Returnsanumericalvalueof4,correspondingtoThursday.

Usage

Thursday

Example

Thursdaywillreturnavalueof4

315

Time2Time_s

ReturnsanumericalvalueindicatingthetimeintheHHmmssformat,correspondingtothespecifiedtimeintheHHmmformat.

Thetimeisreturnedinthe24-hourHHmmssformat,where130000=1:00:00PM,andspecifiedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

Time2Time_s(HHmm)

Where:HHmm-anumericalexpressionspecifyingthetime

Example

Time2Time_s(1015)willreturnavalueof101500

Time2Time_s(1545)willreturnavalueof154500

316

TimeToString

Returnsastringexpressioncorrespondingtothetime(fractional)portionofthespecifiedDateTimevalue.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

TimeToString(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevaluetobeconvertedtoastringexpressionrepresentingthetime

Notes

TheoutputexampleisinthedefaultUSregionaltimeformat.TimeformatiscontrolledbytheRegionalOptionssettingsthatcanbeaccessedfromtheControlPaneloftheWindowsXPoperatingsystem.

Example

TimeToString(39448.75000000)willreturnthestring"6:00PM"

317

Time_s2Time

ReturnsanumericalvalueindicatingthetimeintheHHmmformat,correspondingtothespecifiedtimeintheHHmmssformat;thesecondsaretruncated.

Thetimeisreturnedinthe24-hourHHmmformat,where1300=1:00PM,andspecifiedinthe24-hourHHmmssformat,where130000=1:00:00PM.

Usage

Time_s2Time(HHmmss)

Where:HHmmss-anumericalexpressionspecifyingthetime

Example

Time_s2Time(101520)willreturnavalueof1015

Time_s2Time(154548)willreturnavalueof1545

318

Tuesday

Returnsanumericalvalueof2,correspondingtoTuesday.

Usage

Tuesday

Example

Tuesdaywillreturnavalueof2

319

Wednesday

Returnsanumericalvalueof3,correspondingtoWednesday.

Usage

Wednesday

Example

Wednesdaywillreturnavalueof3

320

Year

Returnsanumericalvalue,indicatingtheyearofthespecifiedELDate.

ELDateisspecifiedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

Year(YYYMMdd)

Where:YYYMMdd-anumericalexpression,specifyingthedateinELYYYMMddformat

Example

Year(1080101)willreturnavalueof108,indicatingtheyearof2008

Year(990605)willreturnavalueof99,indicatingtheyearof1999

321

YearFromDateTime

ReturnsanumericalvalueindicatingtheyearforthespecifiedDateTimevalue.

TheintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

Usage

YearFromDateTime(DateTime)

Where:DateTime-adouble-precisiondecimalDateTimevalue

Example

YearFromDateTime(39449.25000000)willreturnavalueof2008,indicatingtheyearof2008

322

ArrayDeclaresoneormorenamesasarrays,containingmultiplevariabledataelements;specifiesthearraystructure,dataelementstypeandinitialvalue,updatebasis,anddatanumber,foreachofthearrays.

Dataelementstypecanbenumerical,string,ortrue/false.

Thenumberofelementsinanarraycanbefixedordynamic(unlimited).

Inarrayswithafixednumberofelements,theelementscanbearrangedinsingleormultipledimensions.Aone-dimensional10-elementarraycontains10elements,atwo-dimensional10-elementby10-elementarraycontains100elements,athree-dimensional10by10by10elementarraycontains1000elements,afour-dimensional10by10by10by10elementarraycontains10000elements,etc.ThemaximumnumberofarraydimensionsinPowerLanguageis9.

Eachelementinanarrayisreferencedbyoneormoreindexnumbers,oneforeachofthedimensions.Indexingstartsat0foreachofthedimensions.

Dynamicarrays(arrayswithanunlimitednumberofelements)areone-dimensional,andareinitializedatdeclarationashavingonlyoneelement.DeclareddynamicarrayscanberesizedusingArray_SetMaxIndex.

Elementscanbemanipulatedindividuallyorasagroup,inallorpartofanarray.

Usage

Array:<IntraBarPersist>ArrayName1[D1,D2,D3,etc.](InitialValue1<,DataN>),<IntraBarPersist>ArrayName2[D1,D2,D3,etc.](InitialValue2<,DataN>),etc.

Parametersinsidetheangledbracketsareoptional

Parameters

IntraBarPersist-anoptionalparameter;specifiesthatthevalueofthearrayelementsistobeupdatedoneverytickIfthisparameterisnotspecified,thevaluewillbeupdatedatthecloseofeachbar.

ArrayName-anexpressionspecifyingthearrayname

323

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

D-anumericalexpressionspecifyingthearraysizeinelements,startingat0,foreachofthedimensions;asingleexpressionspecifiesaone-dimensionalarray,twoexpressionsspecifyatwo-dimensional(D1byD2)array,threeexpressionsspecifyathree-dimensional(D1byD2byD3)array,etc.Adynamicarray,withanunlimitednumberofelements,isspecifiedbytheemptysquarebrackets:[]andwillbeaone-dimensionalarray.

InitialValue-anexpression,specifyingtheinitialvalueanddefiningthedatatypeforalloftheelementsinthearrayThevaluecanbeanumerical,string,ortrue/falseexpression;thetypeoftheexpressiondefinesthedatatype.

DataN-anoptionalparameter;specifiestheDataNumberofthedataseriesthearrayistobetiedtoIfthisparameterisnotspecified,thearraywillbetiedtothedefaultdataseries.

Example

DeclareLengthandSFactoras9-elementone-dimensionalnumericalarrayswithdataelements'initialvaluesof0:

Array:Length[8](0),SFactor[8](0);

DeclareMax_Priceasa24-elementby60-elementtwo-dimensionalnumericalarray,updatedoneverytick,tiedtotheserieswithData#2,andwithdataelements'initialvaluesequaltothevalueofClosefunction:

Array:IntraBarPersistMax_Price[23,59](Close,Data2);

DeclareHighs2asadynamicnumericalarraywithdataelements'initialvaluesof0:

Array:Highs2[](0);

324

ArraysSameastheArray

325

InputDeclaresoneormorenamesasinputs;specifiesthedefaultvalueanddefinestheinputtypeforeachinput.

Inputscanbenumerical,string,ortrue/false.Oncedeclared,thevalueoftheinputcannotbemodifiedbythestudy'scode.

Usage

Input:InputName1(DefaultValue1),InputName2(DefaultValue2),etc.

Parameters

InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

DefaultValue-anexpressionspecifyingthedefaultvalueanddefiningtheinputtype

Theexpressioncanbenumerical,string,ortrue/false;thetypeoftheexpressiondefinestheinputtype.

Example

DeclareLengthasanumericalinputwiththedefaultvalueof20:

Input:Length(20);

DeclarePriceasanumericalinputwiththedefaultvalueequaltothevalueofClosefunction,andNameasacharacterstringinputwiththedefaultvalueof"LastClose":

Input:Price(Close),Name("LastClose");

DeclareDraw_Lineasatrue/falseinputwiththedefaultvalueofTrue:

326

Input:Draw_Line(True);

327

InputsSameastheInput

328

IntraBarPersistUsedinvariableandarraydeclarationstatements,beforeavariableorarrayname,tospecifythatthevalueofthevariableorarrayelementsaretobeupdatedoneverytick.

IfIntraBarPersistisnotspecified,thevaluewillbeupdatedatthecloseofeachbar.

Usage

Declaration:[IntraBarPersist]Name(InitialValue1)

Example

DeclareMaxasanumericalvariable,updatedoneverytick,withtheinitialvalueof100:

Variable:IntraBarPersistMax(100);

DeclareMax_Priceasa24-elementsingle-dimensionnumericalarray,updatedoneverytick,andwithdataelements'initialvaluesof0:

Array:IntraBarPersistMax_Price[23](0);

329

NumericUsedinfunctioninputdeclarationstatementstodefineaninputasNumerical.

InputdefinedasNumericalcanbeusedbothasaNumericalSimpleaswellasaNumericalSeriesinput;thevalueofaSimpleinputisconstantfrombartobarandthushasnohistory,whilethevalueofaSeriesinputmayvaryfrombartobarandcanbereferencedhistorically.

Usage

Input:InputName(Numeric)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareLengthasaNumericalfunctioninput:

Input:Length(Numeric);

330

NumericArrayUsedinfunctioninputdeclarationstatementstodefineaninputasaNumericalArraywithaspecifiednumberofdimensions.

InputdefinedasNumericalcanbeusedbothasaNumericalSimpleaswellasaNumericalSeriesinput;thevalueofaSimpleinputisconstantfrombartobarandthushasnohistory,whilethevalueofaSeriesinputmayvaryfrombartobarandcanbereferencedhistorically.

Usage

Input:InputName[M1,M2,M3,etc.](NumericArray)

Parameters

InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

M-aninputvariablethatrepresentsthemaximumindexvalueforeachdimensionofthearraypassedtothefunction;asingleinputvariablespecifiesaone-dimensionalarrayinput,twoinputvariablesspecifyatwo-dimensional(M1byM2)arrayinput,threeinputvariablesspecifyathree-dimensional(M1byM2byM3)arrayinput,etc.

Aninputwillonlyacceptanarraywiththespecifiednumberofdimensions.

Example

DeclareLengthasaone-dimensionalNumericalArrayfunctioninput:

Input:Length[X](NumericArray);

ThemaximumindexvalueforthearraypassedtothefunctionwillbeassignedtoinputvariableX.

331

DeclareTableasathree-dimensionalNumericalArrayfunctioninput:

Input:Table[X,Y,Z](NumericArray);

ThemaximumindexvalueforeachdimensionofthearraypassedtothefunctionwillbeassignedtoinputvariablesX,Y,andZ.

332

NumericArrayRefUsedinfunctioninputdeclarationstatementstodefineaninputasPassedbyReferenceNumericalArraywithaspecifiednumberofdimensions.

DeclaringaninputasPassedbyReferenceenablesthefunctiontomodifythevaluesofvariablespassedastheinput.

Usage

Input:InputName[M1,M2,M3,etc.](NumericArrayRef)

Parameters

InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

M-aninputvariablethatrepresentsthemaximumindexvalueforeachdimensionofthearraypassedtothefunction;asingleinputvariablespecifiesaone-dimensionalarrayinput,twoinputvariablesspecifyatwo-dimensional(M1byM2)arrayinput,threeinputvariablesspecifyathree-dimensional(M1byM2byM3)arrayinput,etc.

Aninputwillonlyacceptanarraywiththespecifiednumberofdimensions.

Example

DeclareCountasaPassedbyReferenceone-dimensionalNumericalArrayfunctioninput:

Input:Count[X](NumericArrayRef);

ThemaximumindexvalueforthearraypassedtothefunctionwillbeassignedtoinputvariableX.

DeclareTableasaPassedbyReferencethree-dimensionalNumericalArray

333

functioninput:

Input:Table[X,Y,Z](NumericArrayRef);

ThemaximumindexvalueforeachdimensionofthearraypassedtothefunctionwillbeassignedtoinputvariablesX,Y,andZ.

334

NumericRefUsedinfunctioninputdeclarationstatementstodeclareaPassedbyReferenceNumericalinput.

DeclaringaninputasPassedbyReferenceenablesthefunctiontomodifythevaluesofvariablespassedastheinput.

Usage

Input:InputName(NumericRef)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareBarCountasaPassedbyReferenceNumericalfunctioninput:

Input:BarCount(NumericRef);

335

NumericSeriesUsedinfunctioninputdeclarationstatementstodefineaninputasaNumericalSeries.

ThevalueofaninputdefinedasaSeriesmayvaryfrombartobarandcanbereferencedhistorically.

Usage

Input:InputName(NumericSeries)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclarePriceasaNumericalSeriesfunctioninput:

Input:Price(NumericSeries);

336

NumericSimpleUsedinfunctioninputdeclarationstatementstodefineaninputasNumericalSimple.

ThevalueofaninputdefinedasSimpleisconstantfrombartobarandthushasnohistory.

Usage

Input:InputName(NumericSimple)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareLengthasaNumericalSimplefunctioninput:

Input:Length(NumericSimple);

337

RecalcPersistUsedinvariabledeclarationstatements,beforeavariablename,tospecifythatthevalueofthevariableistobeupdatedoneverytickandthelatestvalueofthisvariableistobesavedafterthestudyrecalculation.

Usage

Declaration:[RecalcPersist]Name(InitialValue1)

Note

Thiskeywordcanbeusedonlywithvariables.Thevariablewithsuchanattributecannotbeserialtype.

Example

DeclareMaxasanumericalvalue,updatedoneverytick,withinitialvalueof100.

Afterstudyrecalculation,thelatestvalueofMaxwillbesaved:

Variable:RecalcPersistMax(100);

338

StringUsedinfunctioninputdeclarationstatementstodefineaninputasString.

InputdefinedasStringcanbeusedbothasaStringSimpleaswellasaStringSeriesinput;thevalueofaSimpleinputisconstantfrombartobarandthushasnohistory,whilethevalueofaSeriesinputmayvaryfrombartobarandcanbereferencedhistorically.

Usage

Input:InputName(String)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareNameasaStringfunctioninput:

Input:Name(String);

339

StringArrayUsedinfunctioninputdeclarationstatementstodefineaninputasaStringArraywithaspecifiednumberofdimensions.

InputdefinedasStringcanbeusedbothasaStringSimpleaswellasaStringSeriesinput;thevalueofaSimpleinputisconstantfrombartobarandthushasnohistory,whilethevalueofaSeriesinputmayvaryfrombartobarandcanbereferencedhistorically.

Usage

Input:InputName[M1,M2,M3,etc.](StringArray)

Parameters

InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

M-aninputvariablethatrepresentsthemaximumindexvalueforeachdimensionofthearraypassedtothefunction;asingleinputvariablespecifiesaone-dimensionalarrayinput,twoinputvariablesspecifyatwo-dimensional(M1byM2)arrayinput,threeinputvariablesspecifyathree-dimensional(M1byM2byM3)arrayinput,etc.

Aninputwillonlyacceptanarraywiththespecifiednumberofdimensions.

Example

DeclareMessagesasaone-dimensionalStringArrayfunctioninput:

Input:Messages[X](StringArray);

ThemaximumindexvalueforthearraypassedtothefunctionwillbeassignedtoinputvariableX.

DeclareMessageTableasathree-dimensionalStringArrayfunctioninput:

340

Input:MessageTable[X,Y,Z](StringArray);

ThemaximumindexvalueforeachdimensionofthearraypassedtothefunctionwillbeassignedtoinputvariablesX,Y,andZ.

341

StringArrayRefUsedinfunctioninputdeclarationstatementstodefineaninputasPassedbyReferenceStringArraywithaspecifiednumberofdimensions.

DeclaringaninputasPassedbyReferenceenablesthefunctiontomodifythevaluesofvariablespassedastheinput.

Usage

Input:InputName[M1,M2,M3,etc.](StringArrayRef)

Parameters

InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

M-aninputvariablethatrepresentsthemaximumindexvalueforeachdimensionofthearraypassedtothefunction;asingleinputvariablespecifiesaone-dimensionalarrayinput,twoinputvariablesspecifyatwo-dimensional(M1byM2)arrayinput,threeinputvariablesspecifyathree-dimensional(M1byM2byM3)arrayinput,etc.

Aninputwillonlyacceptanarraywiththespecifiednumberofdimensions.

Example

DeclareMessagesasaPassedbyReferenceone-dimensionalStringArrayfunctioninput:

Input:Messages[X](StringArrayRef);

ThemaximumindexvalueforthearraypassedtothefunctionwillbeassignedtoinputvariableX.

DeclareCommentsTableasaPassedbyReferencethree-dimensionalStringArray

342

functioninput:

Input:CommentsTable[X,Y,Z](StringArrayRef);

ThemaximumindexvalueforeachdimensionofthearraypassedtothefunctionwillbeassignedtoinputvariablesX,Y,andZ.

343

StringRefUsedinfunctioninputdeclarationstatementstodeclareaPassedbyReferenceStringinput.

DeclaringaninputasPassedbyReferenceenablesthefunctiontomodifythevaluesofvariablespassedastheinput.

Usage

Input:InputName(StringRef)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareMessageasaPassedbyReferenceStringfunctioninput:

Input:Message(StringRef);

344

StringSeriesUsedinfunctioninputdeclarationstatementstodefineaninputasStringSeries.

ThevalueofaninputdefinedasaSeriesmayvaryfrombartobarandcanbereferredtohistorically.

Usage

Input:InputName(StringSeries)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareMessagesasaStringSeriesfunctioninput:

Input:Messages(StringSeries);

345

StringSimpleUsedinfunctioninputdeclarationstatementstodefineaninputasStringSimple.

ThevalueofaninputdefinedasSimpleisconstantfrombartobarandthushasnohistory.

Usage

Input:InputName(StringSimple)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareNameasaStringSimplefunctioninput:

Input:Name(StringSimple);

346

TrueFalseUsedinfunctioninputdeclarationstatementstodefineaninputastrue/false.

Inputdefinedastrue/falsecanbeusedbothasatrue/falseSimpleaswellasatrue/falseSeriesinput;thevalueofaSimpleinputisconstantfrombartobarandthushasnohistory,whilethevalueofaSeriesinputmayvaryfrombartobarandcanbereferencedhistorically.

Usage

Input:InputName(TrueFalse)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareOvernightasatrue/falsefunctioninput:

Input:Overnight(TrueFalse);

347

TrueFalseArrayUsedinfunctioninputdeclarationstatementstodefineaninputasatrue/falseArraywithaspecifiednumberofdimensions.

Inputdefinedastrue/falsecanbeusedbothasatrue/falseSimpleaswellasatrue/falseSeriesinput;thevalueofaSimpleinputisconstantfrombartobarandthushasnohistory,whilethevalueofaSeriesinputmayvaryfrombartobarandcanbereferencedhistorically.

Usage

Input:InputName[M1,M2,M3,etc.](TrueFalseArray)

Parameters

InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

M-aninputvariablethatrepresentsthemaximumindexvalueforeachdimensionofthearraypassedtothefunction;asingleinputvariablespecifiesaone-dimensionalarrayinput,twoinputvariablesspecifyatwo-dimensional(M1byM2)arrayinput,threeinputvariablesspecifyathree-dimensional(M1byM2byM3)arrayinput,etc.

Aninputwillonlyacceptanarraywiththespecifiednumberofdimensions.

Example

DeclareUpTrendasaone-dimensionaltrue/falseArrayfunctioninput:

Input:UpTrend[X](TrueFalseArray);

ThemaximumindexvalueforthearraypassedtothefunctionwillbeassignedtoinputvariableX.

348

DeclareFlagTableasathree-dimensionaltrue/falseArrayfunctioninput:

Input:FlagTable[X,Y,Z](TrueFalseArray);

ThemaximumindexvalueforeachdimensionofthearraypassedtothefunctionwillbeassignedtoinputvariablesX,Y,andZ.

349

TrueFalseArrayRefUsedinfunctioninputdeclarationstatementstodefineaninputasPassedbyReferencetrue/falseArraywithaspecifiednumberofdimensions.

DeclaringaninputasPassedbyReferenceenablesthefunctiontomodifythevaluesofvariablespassedastheinput.

Usage

Input:InputName[M1,M2,M3,etc.](TrueFalseArrayRef)

Parameters

InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

M-aninputvariablethatrepresentsthemaximumindexvalueforeachdimensionofthearraypassedtothefunction;asingleinputvariablespecifiesaone-dimensionalarrayinput,twoinputvariablesspecifyatwo-dimensional(M1byM2)arrayinput,threeinputvariablesspecifyathree-dimensional(M1byM2byM3)arrayinput,etc.

Aninputwillonlyacceptanarraywiththespecifiednumberofdimensions.

Example

DeclareTrendasaPassedbyReferenceone-dimensionaltrue/falseArrayfunctioninput:

Input:Trend[X](TrueFalseArrayRef);

ThemaximumindexvalueforthearraypassedtothefunctionwillbeassignedtoinputvariableX.

DeclareTrendTableasaPassedbyReferencethree-dimensionaltrue/falseArray

350

functioninput:

Input:TrendTable[X,Y,Z](TrueFalseArrayRef);

ThemaximumindexvalueforeachdimensionofthearraypassedtothefunctionwillbeassignedtoinputvariablesX,Y,andZ.

351

TrueFalseRefUsedinfunctioninputdeclarationstatementstodeclareaPassedbyReferencetrue/falseinput.

DeclaringaninputasPassedbyReferenceenablesthefunctiontomodifythevaluesofvariablespassedastheinput.

Usage

Input:InputName(TrueFalseRef)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareFlagasaPassedbyReferencetrue/falsefunctioninput:

Input:Flag(TrueFalseRef);

352

TrueFalseSeriesUsedinfunctioninputdeclarationstatementstodefineaninputasatrue/falseSeries.

ThevalueofaninputdefinedasaSeriesmayvaryfrombartobarandcanbereferencedhistorically.

Usage

Input:InputName(TrueFalseSeries)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareUpTrendasatrue/falseSeriesfunctioninput:

Input:UpTrend(TrueFalseSeries);

353

TrueFalseSimpleUsedinfunctioninputdeclarationstatementstodefineaninputastrue/falseSimple.

ThevalueofaninputdefinedasSimpleisconstantfrombartobarandthushasnohistory.

Usage

Input:InputName(TrueFalseSimple)

Where:InputName-anexpressionspecifyingtheinputname

Thenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

Example

DeclareOvernightasatrue/falseSimplefunctioninput:

Input:Overnight(TrueFalseSimple);

354

VarSameastheVariable

355

VariableDeclaresoneormorenamesasvariables;specifiestheinitialvalue,variabletype,updatebasis,anddatanumberforeachvariable.

Variablescanbenumerical,string,ortrue/false.

Usage

Variable:[IntraBarPersist]VariableName1(InitialValue1[,DataN]),[IntraBarPersist]VariableName2(InitialValue2[,DataN]),etc.

Parametersinsidethesquarebracketsareoptional

Parameters

IntraBarPersist-anoptionalparameter;specifiesthatthevalueofthevariableistobeupdatedoneverytickIfthisparameterisnotspecified,thevaluewillbeupdatedatthecloseofeachbar.

VariableName-anexpression,specifyingthevariablenameThenamecanconsistofletters,underscorecharacters,numbers,andperiods.

Thenamecannotbeginwithanumberoraperiodandisnotcase-sensitive.

InitialValue-anexpression,specifyingtheinitialvalueanddefiningthevariabletypeThevaluecanbeanumerical,string,ortrue/falseexpression;thetypeoftheexpressiondefinesthevariabletype.

DataN-anoptionalparameter;specifiestheDataNumberofthedataseriesthevariableistobetiedtoIfthisparameterisnotspecified,thevariablewillbetiedtothedefaultdataseries.

Example

DeclareAvg.asanumericalvariablewiththeinitialvalueof20:

Variable:Avg.(20);

356

DeclareMaxasanumericalvariable,updatedoneverytick,withtheinitialvalueof100:

Variable:IntraBarPersistMax(100);

DeclareMin_Priceasanumericalvariable,tiedtotheserieswithData#2,andtheinitialvalueequaltothevalueofClosefunction:

Variable:Min_Price(Close,Data2);

DeclareOvernightasatrue/falsevariablewiththeinitialvalueofFalse,andNameasastringvariablewiththeinitialvalueof"Intra-Day":

Variable:Overnight(False),Name("Intra-Day");

357

VariablesSameastheVariable

358

VarsSameastheVariable

359

ArraySizeSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

360

ArrayStartAddrSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

361

BoolSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

362

ByteSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

363

CharSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

364

DefineDLLFuncSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

365

DoubleSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

366

DWORDSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

367

ExternalSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

368

FloatSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

369

iEasyLanguageObjectSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

370

IntSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

371

Int64Theint64isareservedworddefiningthatthepassedorreturnedvalueoffunctionsexportedfromthedllhasthelonglongtype(64-bitrepresentationofaninteger).

Note

DuetoarchitecturalspecificsofPowerLanguage,beforepassingthelonglongtypevalueinadll(orwhenthevalueswerereturnedfromadll)itisconvertedfromthe"double"type(orinto"double"type).Notethatprecisionofthedoubletypevaluesis15decimals.(Valuesrangeofthelonglongtypeisfrom-9,223,372,036,854,775,808to9,223,372,036,854,775,807-19decimalpoints).Itmeansthatwithoutlossofaccuracythevalueswiththerangefrom-999,999,999,999,999to999,999,999,999,999willbepassed.

Example

Definesthedllfunction,whichreceiveslonglongparameter:

DEFINEDLLFUNC:"test_int64.dll",void,"int64test_1",int64;

Definesthedllfunction,whichreturnslonglongvalue:

DEFINEDLLFUNC:"test_int64.dll",int64,"int64test_2";

372

LongSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

373

LPBoolSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

374

LPByteSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

375

LPDoubleSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

376

LPDWORDSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

377

LPFloatSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

378

LPIntSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

379

LPLongSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

380

LPSTRSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

381

LPWORDSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

382

MethodSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

383

OnCreateSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

384

OnDestroySupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

385

SelfSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

386

ThreadSafeDeclaresthefunctionimportedfromDLLasthread-safe.

ItwillincreasetheperformanceofcalculationandoptimizationofthestudiesthatuseexternalDLLs.

Usage

ThreadSafe

Notes

ItisnotrecommendedtoapplyThreadSafeattributetothefunctionsexportedfromelkit32.dll(forexampleFindAddress_).

Example

DEFINEDLLFUNC:ThreadSafe,"user32.dll",Void,"MessageBeep",Int;

WilldeclareMessageBeepfunctionofuser32.dllasthread-safe.

387

UnsignedSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

388

VarSizeSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

389

VarStartAddrSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

390

VoidSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

391

WORDSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

392

#EventsSupportedbyPowerLanguage.

AdetaileddescriptionandusageexampleshavebeenpublishedbyTradeStationTechnologies:EasyLanguageExtensionSDK

393

DOM_AskPriceReturnsaskpriceforthecertaindepthlevelofaparticularsymbol.

Usage

DOM_AskPrice(num)[Data(N)]

where:

(num)-isthenumberofdepthlevel

(N)-isthenumberofthedataseries

Example

DOM_AskPrice(4);willreturntheaskpriceforthe5thlevelofdepthfortheData1

DOM_AskPrice(2)Data2;willreturntheaskpriceforthe3rdlevelofdepthfortheData2

394

DOM_AsksCountReturnsthenumberofaskdepthlevelsavailableforaparticularsymbol.

Usage

DOM_AsksCount[Data(N)]

where:

(N)-isthenumberofthedataseries

Example

DOM_AsksCountwillreturn10if10asklevelsofthemarketdepthareavailablefortheData1

DOM_AsksCountData2willreturn6if6asklevelsofthemarketdepthareavailablefortheData2

395

DOM_AskSizeReturnstheasksizeforthecertaindepthlevelofaparticularsymbol.

Usage

DOM_AskSize(num)[Data(N)]

where:

(num)-isthenumberofdepthlevel

(N)-isthenumberofthedataseries

Example

DOM_AskSize(2)willreturn1500iftheasksizeforthe3rdlevelofdepthonData1is1500

DOM_AskSize(0)Data2willreturn750iftheasksizeforthe1stlevelofdepthonData2is750

396

DOM_BidPriceReturnsbidpriceforthecertaindepthlevelofaparticularsymbol.

Usage

DOM_BidPrice(num)[Data(N)]

where:

(num)-isthenumberofdepthlevel

(N)-isthenumberofthedataseries

Example

DOM_BidPrice(4);willreturnthebidpriceforthe5thlevelofdepthfortheData1

DOM_BidPrice(2)Data2;willreturnthebidpriceforthe3rdlevelofdepthfortheData2

397

DOM_BidsCountReturnsthenumberofbiddepthlevelsavailableforaparticularsymbol.

Usage

DOM_BidsCount[Data(N)]

where:

(N)-isthenumberofthedataseries

Example

DOM_BidsCountwillreturn10if10bidlevelsofthemarketdepthareavailablefortheData1

DOM_BidsCountData2willreturn6if6bidlevelsofthemarketdepthareavailablefortheData2

398

DOM_BidSizeReturnsthebidsizeforthecertaindepthlevelofaparticularsymbol.

Usage

DOM_BidSize(num)[Data(N)]

where:

(num)-isthenumberofdepthlevel

(N)-isthenumberofthedataseries

Example

DOM_BidSize(2)willreturn1500ifthebidsizeforthe3rdlevelofdepthonData1is1500

DOM_BidSize(0)Data2willreturn750ifthebidsizeforthe1stlevelofdepthonData2is750

399

DOM_IsConnectedReturnsalogicalvalueindicatingtheavailabilityofthemarketdepthdata;returnsavalueofTrueifthemarketdepthdataisavailableandavalueofFalseifthemarketdepthdataisnotavailable.

Usage

DOM_IsConnected

Example

Printtheasksizeforthe1stlevelofmarketdepthifthemarketdepthdataisavailable

Variables:

var0(0);

IfDOM_IsConnectedthen

var0=DOM_AskPrice(0);

Print(var0);

400

Array_CompareComparesaspecifiedrangeofelementsofthespecifiedone-dimensionalsourcearray,startingatthespecifiedsourceindex,tothesamerangeofelementsofthespecifiedone-dimensionaldestinationarray,startingatthespecifieddestinationindex.

Sourceanddestinationcanbethesamearrayaswellastwodifferentarrays.

Fornumericalarrays,thenumericalvaluesforeachpairofelementsarecompared.Forstringarrays,theASCIIvaluesofthestringcharacters,withthefirstcharacterofthestringbeingthemostsignificant,arecomparedforeachpairofelements.Fortrue/falsearrays,thelogicalvaluesofeachpairofelementsarecompared,withthevalueoftrueconsideredtobegreaterthanthevalueoffalse.

Returnsavalueof0ifeachrespectivepairofelementscomparedasequal;avalueof1if,forthefirstpairthatwasnotequal,thevalueinthesourcerangewasgreaterthenthevalueinthedestinationrange;andavalueof-1if,forthefirstpairthatwasnotequal,thevalueinthesourcerangewaslessthenthevalueinthedestinationrange.

Usage

Array_Compare(SourceArray,SourceIndex,DestinationArray,DestinationIndex,NumberOfElements

Where:SourceArray-anexpressionspecifyingthenameofthesourcearrayDestinationArray-anexpressionspecifyingthenameofthedestinationarraySourceIndex-anumericalexpressionspecifyingthestartingindexforthesourcearrayDestinationIndex-anumericalexpressionspecifyingthestartingindexforthedestinationarrayNumberOfElements-anumericalexpressionspecifyingthenumberofelementstocompare

Return

0-eachrespectivepairofelementscomparedasequal1-forthefirstpaircomparedthatwasnotequal,thevalueinthesourcerangewasgreaterthenthevalueinthedestinationrange-1-forthefirstpaircomparedthatwasnotequal,thevalueinthesourcerangewaslessthenthevalueinthedestinationrange

401

Example

Assignavalue,indicatingtheresultofcomparingtwo-elementsegments,ofArray1,beginningattheindexof4,andofArray2,beginningattheindexof6,toValue1variable:

Value1=Array_Compare(Array1,4,Array2,6,2);

Assignavalue,indicatingtheresultofcomparingtwo-elementsegmentsthatbeginattheindexof4andattheindexof6withinthesamearray,toValue1variable:

Value1=Array_Compare(Array1,4,Array1,6,2);

402

Array_ContainsWillreturnTrue/Falsevaluedependingonwhetherspecificelementiscontainedintheone-dimensionalarray,ornot.

Usage

Array_Contains(ArrayName,Value)

Where:ArrayName-anexpressionspecifyingthenameofannumerical/string/boolarray.Value-anumerical/string/boolexpressionspecifyingthevaluetosearch.

Example

Assignatrue/falsevalue,indicatingthatvalue4iscontainedinthenumericarrayArray1,toCondition1variable:

Condition1=Array_Contains(Array1,4);

403

Array_CopyCopiesaspecifiednumberofelementsfromthespecifiedone-dimensionalsourcearray,startingatthespecifiedsourceindex;theelementsarecopiedtothespecifiedone-dimensionaldestinationarray,startingatthespecifieddestinationindex.

Sourceanddestinationcanbethesamearrayaswellastwodifferentarrays.

Usage

Array_Copy(SourceArray,SourceIndex,DestinationArray,DestinationIndex,NumberOfElements

Where:SourceArray-anexpressionspecifyingthenameofthesourcearrayDestinationArray-anexpressionspecifyingthenameofthedestinationarraySourceIndex-anumericalexpressionspecifyingthestartingindexforthesourcearrayDestinationIndex-anumericalexpressionspecifyingthestartingindexforthedestinationarrayNumberOfElements-anumericalexpressionspecifyingthenumberofelementstocopy

Example

CopyfromArray1thetwo-elementsegmentbeginningattheindexof4,totheArray2,beginningattheindexof6:

Array_Copy(Array1,4,Array2,6,2);

CopyfromArray1thetwo-elementsegmentbeginningattheindexof4,tothesamearray,beginningattheindexof6:

Array_Copy(Array1,4,Array1,6,2);

404

Array_GetBooleanValue

ReturnstheBooleanvaluewithacertainindexfromnumericalarray.

Usage

Array_GetBooleanValue

Example

AssignthesecondBooleanvalueofthe"arr"arraytoValue1variable:

Array:arr[10](0);Value1=Array_GetBooleanValue(arr,2);

405

Array_GetFloatValue

Returnsthefloatvaluewithacertainindexfromnumericalarray.

Usage

Array_GetFloatValue

Example

AssignthesecondfloatvalueofarrarraytoValue1variable:

Array:arr[10](0);Value1=Array_GetFloatValue(arr,2);

406

Array_GetIntegerValue

Returnstheintegervaluewithacertainindexfromnumericalarray.

Usage

Array_GetIntegerValue

Example

Assignthesecondfloatvalueof"arr"arraytoValue1variable:

Array:arr[10](0);Value1=Array_GetIntegerValue(arr,2);

407

Array_GetMaxIndexReturnsanumericalvalueindicatingthemaximumindexofaone-dimensionalarray.

Arrayindexesstartat0,andarraysizeisequaltothevalueofthemaximumindexplusone.

Usage

Array_GetMaxIndex(ArrayName)

Where:ArrayName-anexpressionspecifyingthenameofanarray

Example

AssignavaluethatindicatesthemaximumindexofArray1totheMaxIndexvariable:

MaxIndex=Array_GetMaxIndex(Array1);

408

Array_GetStringValue

Returnsthestringvaluewithacertainindexfromnumericalarray.

Usage

Array_GetStringValue

Example

Assignthesecondfloatvalueof"arr"arraytoValue1variable:

Array:arr[10](0);Value1=Array_GetStringValue(arr,2);

409

Array_GetTypeReturnsanumericalvalueindicatingthetypeofthespecifiedarray.

Usage

Array_GetType(ArrayName)

Where:ArrayName-anexpressionspecifyingthenameofanarray

Return

2-atrue/falsearray3-astringarray7-adouble-precisionnumericalarray

Example

Assignavalue,indicatingthetypeofArray1,toValue1variable:

Value1=Array_GetType(Array1);

410

Array_IndexOfWillreturnindexofaspecificelementinone-dimensionalarray.Willreturn-1ifthearraywillnotcontainthespecificelement.

Usage

Array_IndexOf(ArrayName,Value)

Where:ArrayName-anexpressionspecifyingthenameofannumerical/string/boolarray.Value-anumerical/string/boolexpressionspecifyingthevaluetosearchfor.

Example

Assignanindexofvalue4toValue1variableinthenumericarrayArray1:

Value1=Array_IndexOf(Array1,4);

411

Array_SetBooleanValue

SetstheBooleanvalueforacertainindexofnumericalarray.

Usage

Array_SetBooleanValue

Example

Setthefirstandthirdvaluesof"arr"arraytoTRUE:

Array:arr[10](False);Array_SetBooleanValue(arr,1,True);Array_SetBooleanValue(arr,1,True);

412

Array_SetFloatValue

Setsthefloatvalueforacertainindexofnumericalarray.

Usage

Array_SetFloatValue

Example

Setthefirstandthirdvaluesof"arr"arrayto1.789:

Array:arr[10](False);Array_SetFloatValue(arr,1,1.789000352);Array_SetFloatValue(arr,3,1.789000352);

413

Array_SetIntegerValue

Setstheintegervalueforacertainindexofnumericalarray.

Usage

Array_SetIntegerValue

Example

Setthefirstandthirdvaluesof"arr"arrayto500:

Array:arr[10](False);Array_SetIntegerValue(arr,1,500);Array_SetIntegerValue(arr,3,500);

414

Array_SetMaxIndexResizesadeclareddynamicarraytoaspecifiednumberofelements;returnsavalueofTruetoindicateasuccessfulresize.

Anarraycanberesizedtoalargerortoasmallernumberofelements;anyelementsaddedtoanarraywillbeassignedtheinitialvaluethatwasspecifiedatarraydeclaration.

Usage

Array_SetMaxIndex(ArrayName,MaxIndex)

Where:ArrayName-anexpressionspecifyingthenameofanarraytoberesizedMaxIndex-anumericalexpressionspecifyingthemaximumindexofthearray*

*Arrayindexesstartat0,andarraysizeisequaltothevalueofMaxIndexplusone.

Return

True-resizesucessfull

False-resizefailed

Example

ResizethedynamicarrayArray1to10elementsbyspecifyingamaximumindexvalueof9:

Array_SetMaxIndex(Array1,9);

AssignavaluethatindicatesastatusoftheresizeofArray1totheResizeReportvariable:

ResizeReport=Array_SetMaxIndex(Array1,9);

AvalueofTruewillindicateasuccessfulresize,andavalueofFalsewillindicateafailedresize.

415

416

Array_SetStringValue

Setsthestringvalueforacertainindexofnumericalarray.

Usage

Array_SetStringValue

Example

Setthefirstandthirdvaluesof"arr"arrayto"arraystring":

Array:arr[10](False);Array_SetStringValue(arr,1,"arraystring");Array_SetStringValue(arr,3,"arraystring");

417

Array_SetValRangeAssignsaspecifiedvaluetoeachelementwithinaspecifiedrange,ofthespecifiedone-dimensionalarray.

Usage

Array_SetValRange(ArrayName,StartIndex,EndIndex,Value)

Where:ArrayName-anexpressionspecifyingthenameofanarrayStartIndex-anumericalexpressionspecifyingthestartingindexfortherangeEndIndex-anumericalexpressionspecifyingtheendingindexfortherangeValue-avaluetobeassignedtoeachelementwithintherange

Example

AssignavalueofTruetoeachelementwithinasegment,beginningatindex4andendingatindex6,ofArray1:

Array_SetValRange(Array1,4,6,True);

418

Array_SortSorts,ineitherascendingordescendingorder,therangeofelements,specifiedbythestartingandendingindexes,ofthespecifiedone-dimensionalarray.

Fornumericalarrays,theelementsaresortedaccordingtothevaluestheycontain.Forstringarrays,theelementsaresortedaccordingtotheASCIIvaluesofthestringcharacters,withthefirstcharacterofthestringbeingthemostsignificant.Forsortingtrue/falsearrayelements,thevalueoftrueisconsideredtobegreaterthanthevalueoffalse.

Usage

Array_Sort(ArrayName,StartIndex,EndIndex,SortOrder)

Where:ArrayName-anexpressionspecifyingthenameofanarrayStartIndex-anumericalexpressionspecifyingthestartingindexfortherangeEndIndex-anumericalexpressionspecifyingtheendingindexfortherangeSortOrder-atrue/falsevaluespecifyingthesortorder;truespecifiesascendingorder,andfalsespecifiesdescendingorder

Example

SorttheelementsinthesegmentofArray1thatbeginsattheindexof4andendsattheindexof6,inascendingorder:

Array_Sort(Array1,4,6,True);

419

Array_SumReturnsasumofthevaluescontainedinarangeofelements,specifiedbythestartingandendingindexes,ofthespecifiedone-dimensionalarray;returnsthenumberoftrueelementsifthearraycontainstrue/falsevalues;returnsavalueof0ifthearraycontainsstringvalues.

Usage

Array_Sum(ArrayName,StartIndex,EndIndex)

Where:ArrayName-anexpressionspecifyingthenameofanarrayStartIndex-anumericalexpressionspecifyingthestartingindexfortherangeEndIndex-anumericalexpressionspecifyingtheendingindexfortherange

Example

Assignavalue,indicatingasumofthevaluescontainedinthesegmentofArray1thatbeginsattheindexof4andendsattheindexof6,toValue1variable:

Value1=Array_Sum(Array1,4,6);

420

Fill_Array

Assignsaspecifiedvaluetoeachelementofthespecifiedone-dimensionalarray.

Usage

Fill_Array(ArrayName,Value)

Where:ArrayName-anexpressionspecifyingthenameofanarrayValue-avaluetobeassignedtoeachelementofthearray

Example

AssignavalueofTruetoeachelementofArray1:

Fill_Array(Array1,True);

421

BaseDataNumber

ReturnsanumericalvalueindicatingtheDataNumberoftheseriesthatthestudyisappliedto.

Usage

BaseDataNumber

Example

Assignavalue,indicatingtheDataNumberoftheseriesthatthestudyisappliedto,toValue1variable:

Value1=BaseDataNumber;

422

CurrentDataNumber

ReturnsanumericalvalueindicatingtheDataNumberoftheseriesthatthefunctionisbeingcalculatedon.

Usage

CurrentDataNumber

Example

Assignavalue,indicatingtheDataNumberoftheseriesthatthefunctionisbeingcalculatedon,toValue1variable:

Value1=CurrentDataNumber;

423

ExecOffset

Returnsanumericalvalueindicatingthefunctionexecutionoffsetinbars.

Usage

ExecOffset

Example

Assignavalue,indicatingthefunctionexecutionoffset,toValue1variable:

Value1=ExecOffset;

424

GetAppInfoReturnsanumericalvalue,representingthespecifiedattributeofthecallingapplication.

Usage

GetAppInfo(Attribute)

Parameters

aiApplicationType-identifiesthecallingapplication:

0=Unknown

1=Chart

2=Scanner

aiBarSpacing-specifiesreturnofthenumberofspacesbetweenthebarsonachartGetAppInfowillreturnavalue,indicatingthebarspacingofachart.

aiCalcReason-returnsanumericalvalue,indicatingthereasonofcalculationinitialization(i.e.returns0(CalcReason_Default)whencalculationwastriggeredbyanewbar/tick):

0(CalcReason_default)-calculationistobeinitializedwhenthenewbar/tickappeared.

1(CalcReason_mouseLClick)calculationistobeinitializedafterleft-clickonthechart.

2(CalcReason_mouseRClick)-calculationistobeinitializedafterright-clickonthechart.

3(CalcReason_timer)calculationistobeinitializedafterexpirationofRecalcLastBarAftertimeout.

4(CalcReason_MPChange)calculationistobeinitializedaftermarketpositionfortheinstrumenthasbeenchanged(forsignalsonly).

425

5(CalcReason_OrderFilled)calculationistobeinitializedafterorderfilledevent(forsignalsonly).

aiHighestDispValue-specifiesreturnofthehighestpricevaluethatcouldbedisplayedinthecurrentchartwindowGetAppInfowillreturnthehighestpricevaluethatcouldbedisplayedonachart.

aiLowestDispValue-specifiesreturnofthelowestpricevaluethatcouldbedisplayedinthecurrentchartwindowGetAppInfowillreturnthelowestpricevaluethatcouldbedisplayedonachart.

aiLeftDispDateTime-specifiesreturnofthedateandtimeoftheleftmostbardisplayedinthecurrentchartwindowGetAppInfowillreturntheDateTimevalueoftheleftmostbardisplayedonachart;theintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

aiRightDispDateTime-specifiesreturnofthedateandtimeoftherightmostbardisplayedinthecurrentchartwindowGetAppInfowillreturntheDateTimevalueoftherightmostbardisplayedonachart;theintegerportionoftheDateTimevaluespecifiesthenumberofdayssinceJanuary1st,1900,andthefractionalportionoftheDateTimevaluespecifiesthefractionofthedaysincemidnight.

aiRow-identifiesthesymbol'srownumberinScanner;returnsapositivenon-zerovaluefromaScannerapplicationelsereturns0.

aiSpaceToRight-specifiesreturnoftherightmargin,inbars,ofthecurrentchartwindowGetAppInfowillreturntherightmargin,inbars,ofachart.

aiOptimizing-specifiesreturnofanumericalvalue,indicatingwhetherthecallingapplicationiscurrentlyperforminganoptimizationGetAppInfowillreturnavalueof1onlyifthecallingapplicationiscurrentlyperforminganoptimization,andavalueof0inallothercases.

aiStrategyAuto-specifiesreturnofanumericalvalue,indicatingwhetherthecallingapplicationisusingAutomatedTradeExecutionGetAppInfowillreturnavalueof1onlyifthecallingapplicationisusingAutomatedTradeExecution,andavalueof0inallothercases.

aiStrategyAutoConf-specifiesreturnofanumericalvalue,indicatingwhetherthecallingapplicationisusingAutomatedTradeExecutionwithorderconfirmationturnedoffGetAppInfowillreturnavalueof0onlyifthecalling

426

applicationisusingAutomatedTradeExecutionwithorderconfirmationturnedoff,andavalueof1inallothercases.

aiIntrabarOrder-specifiesreturnofanumericalvalue,indicatingwhetherthecallingapplicationisrunningthesignalwithintra-barordergenerationturnedonGetAppInfowillreturnavalueof1onlyifthecallingapplicationisrunningthesignalwithintra-barordergenerationturnedon,andavalueof0inallothercases.

aiAppId-specifiesreturnofanumericalvalue,usedtoidentifythecallingapplicationGetAppInfowillreturnauniquenon-zerointegeridentifyingthecallingapplication.

aiRealTimeCalc-specifiesreturnofanumericalvalue,indicatingwhetherthecallingapplicationscalculationsarebasedonreal-timedataGetAppInfowillreturnavalueof1onlyifthecallingapplication'scalculationsarebasedonreal-timedata,andavalueof0inallothercases.

aichartshiftpercent-returnstheChartShiftvalueinpercentsfromFormatWindow->X-TimeScale.Thevalueisupdatedonthefly.

Example

GetAppInfo(aiBarSpacing)willreturnavalue,indicatingthebarspacingofachart

GetAppInfo(aiStrategyAutoConf)willreturnavalueof0ifthecallingapplicationisusingAutomatedTradeExecutionwithorderconfirmationturnedoff;otherwise,willreturnavalueof1

GetAppInfo(aiRealTimeCalc)willreturnavalueof1ifthecallingapplicationscalculationsarebasedonreal-timedata;otherwise,willreturnavalueof0

[ProcessMouseEvents=true];switch(getappinfo(aicalcreason))begincaseCalcReason_MouseLClick:ifMouseClickCtrlPressedthenbeginvar:var0(0),var1(0);repeatif0=var0thenbeginvar0=MouseClickDateTime;break;end;

427

until(false);end;end;var1=datetime2eltime(var0);print("TimeoftheBar=",var1);

WillreturnthetimeofthebarafterleftclickonitpressingCtrlbuttononthekeyboard.

428

GetCDRomDrive

ReturnsastringexpressionofthedriveletterforthefirstCD-ROMdrivedetected.

Usage

GetCDRomDrive

Example

Variables:Drive("D");Drive=GetCDRomDrive;

WillsetthevariableDriveequaltothefirstCD-ROMdrivedetected.

429

GetCountryReturnsthelocalename,correspondingtotheStandardsandformatssettingselectedintheRegionalOptionssettingsoftheWindowsXPControlPanel.

Usage

GetCountry

Example

GetCountrywillreturnastringexpression"UnitedStates"forthesetting"English(UnitedStates)"

430

GetCurrencyReturnsthecurrencysymbolselectedintheRegionalOptionssettingsoftheWindowsXPControlPanel.

Usage

GetCurrency

Example

GetCurrencywillreturnthe"$"symbolfortheUSDollar

431

GetUserID

Returnsauniqueidentificationnumber(UserID)forthePCthatthestudyisbeingrunon.

UserIDnumberisusedforstudyprotection.

Usage

GetUserID

Example

Assignavalue,indicatingtheUserID,toValue1variable:

Value1=GetUserID;

432

GetUserNameReturnsMultiChartsregistrationname(UserName)forMultiChartsinstallationonthePCthatthestudyisbeingrunon.

UserNameisusedforstudyprotection.

Usage

GetUserName

Example

Assignavalue,indicatingtheUserName,toUserNamevariable:

Var:UserName("");

UserName=GetUserName;

433

MaxBarsBack

ReturnsanumericalvalueindicatingtheMaximumBarsBacksettingforthestudy.

Allstudiesbasedonpastdatauseacertainnumberofbarsfortheircalculations.ThenumberofbarsiscalledMaximumnumberofbarsastudywillreference,orMaximumBarsBack.

Usage

MaxBarsBack

Example

Assignavalue,indicatingtheMaximumBarsBacksettingforthestudy,toValue1variable:

Value1=MaxBarsBack;

434

MaxBarsForward

Returnsanumericalvalueindicatingthesize,inbars,oftherightmarginonthechart.

Rightmarginisusedbythestudiesthatvisualizethepredictedpricemovement.

Usage

MaxBarsForward

Example

Assignavalue,indicatingthesizeoftherightmarginofthechart,toValue1variable:

Value1=MaxBarsForward;

435

SetMaxBarsBack

SetsanumericalvalueindicatingtheMaximumBarsBacksettingforthestudy.

Allstudiesbasedonpastdatauseacertainnumberofbarsfortheircalculations.

ThenumberofbarsiscalledMaximumnumberofbarsastudywillreference,orMaximumBarsBack.

Usage

SetMaxBarsBack(BarsBack)

Where:BarsBack-numericalexpression,specifyingthenumberofbarsback

Note

BarsBackcan'tbeanegativevalue.

Example

Setavalue,indicatingtheMaximumBarsBacksettingforthestudyto50:

SetMaxBarsBack(50);

436

Abort

Generatesarun-timeerrorandabortstheexecutionofthestudy.

Usage

Abort

Example

Abortthestudysexecution:

Abort;

437

CommandLine

Passesastringexpressionfromscripttocommandline.

Usage

CommandLine("Expression")

Seethelistofsupportedexpressionsforthecommandline.

Examples

CommandLine(".rld");

Reloadsthechartwherethescriptisapplied(reloadsallchartwherethesamesymbolisused).

CommandLine(".at_toggle");

Turnson/offautotradingonthechartwherethescriptisapplied(ifitisusedtoturnautotradingon,thepoppedupconfirmationwindowcannotbeskippedandamanualclickon"OK"isrequired).

CommandLine(".csydnum=1,name=AUD/CHF,df=LMAX");

Changesthesymbolplottedasdataseries1toAUD/CHFandthedatasourcetoLMAXonthechartwherethescriptisapplied.

CommandLine(".isyname=@ES#,df=IQFeed,res=1min,desc=E-MINIS&P;500MARCH2013,from=12/31/2012,to=5/10/2013");

Inserts1minutegraphofS&P;mini500fromIQFeedstartingfrom31thofDecember2012upto10thofMay2013asadditionaldataseriestothechartwherethescriptisapplied.

CommandLine(".iidname=MACD,base=1,bref=100");

AppliesMACDindicatortothedataseries1withMaxBarsBackparameter=100to

438

thechartwherethescriptisapplied.

CommandLine(".rldint2weeks");

Reloads2weeksofdataonthechartwherethescriptisapplied.

439

fpcExactAccuracy

Constant,usedincombinationwithSetFPCompareAccuracytodesignatethefloatingpointcomparetolerancevalueof0.00;canbesubstitutedbyanumericalvalueof5.

Usage

SetFPCompareAccuracy(fpcExactAccuracy)

or:

SetFPCompareAccuracy(5)

Example

SetthefloatingpointcompareaccuracytoExact:

SetFPCompareAccuracy(fpcExactAccuracy);

SetthefloatingpointcompareaccuracytoExact:

SetFPCompareAccuracy(5);

440

fpcHighAccuracy

Constant,usedincombinationwithSetFPCompareAccuracytodesignatethefloatingpointcomparetolerancevalueof2.2204460492503131e-14;canbesubstitutedbyanumericalvalueof3.

Usage

SetFPCompareAccuracy(fpcHighAccuracy)

or:

SetFPCompareAccuracy(3)

Example

SetthefloatingpointcompareaccuracytoHigh:

SetFPCompareAccuracy(fpcHighAccuracy);

SetthefloatingpointcompareaccuracytoHigh:

SetFPCompareAccuracy(3);

441

fpcLowAccuracy

Constant,usedincombinationwithSetFPCompareAccuracytodesignatethefloatingpointcomparetolerancevalueof2.2204460492503131e-10;canbesubstitutedbyanumericalvalueof1.

Usage

SetFPCompareAccuracy(fpcLowAccuracy)

or:

SetFPCompareAccuracy(1)

Example

SetthefloatingpointcompareaccuracytoLow:

SetFPCompareAccuracy(fpcLowAccuracy);

SetthefloatingpointcompareaccuracytoLow:

SetFPCompareAccuracy(1);

442

fpcMedAccuracy

Constant,usedincombinationwithSetFPCompareAccuracytodesignatethefloatingpointcomparetolerancevalueof2.2204460492503131e-12;canbesubstitutedbyanumericalvalueof2.

Usage

SetFPCompareAccuracy(fpcMedAccuracy)

or:

SetFPCompareAccuracy(2)

Example

SetthefloatingpointcompareaccuracytoMedium:

SetFPCompareAccuracy(fpcMedAccuracy);

SetthefloatingpointcompareaccuracytoMedium:

SetFPCompareAccuracy(2);

443

fpcVeryHighAccuracy

Constant,usedincombinationwithSetFPCompareAccuracytodesignatethefloatingpointcomparetolerancevalueof2.2204460492503131e-16;canbesubstitutedbyanumericalvalueof4.

Usage

SetFPCompareAccuracy(fpcVeryHighAccuracy)

or:

SetFPCompareAccuracy(4)

Example

SetthefloatingpointcompareaccuracytoVeryHigh:

SetFPCompareAccuracy(fpcVeryHighAccuracy);

SetthefloatingpointcompareaccuracytoVeryHigh:

SetFPCompareAccuracy(4);

444

fpcVeryLowAccuracy

Constant,usedincombinationwithSetFPCompareAccuracytodesignatethefloatingpointcomparetolerancevalueof2.2204460492503131e-8;canbesubstitutedbyanumericalvalueof0.

Usage

SetFPCompareAccuracy(fpcVeryLowAccuracy)

or:

SetFPCompareAccuracy(0)

Example

SetthefloatingpointcompareaccuracytoVeryLow:

SetFPCompareAccuracy(fpcVeryLowAccuracy);

SetthefloatingpointcompareaccuracytoVeryLow:

SetFPCompareAccuracy(0);

445

RaiseRunTimeError

Generatesarun-timeerroranddisplaysthespecifiederrormessage.

Arun-timeerrorwillcausetheexecutionofthestudytobeaborted.

Usage

RaiseRunTimeError("Message")

Where:Message-astringexpressionspecifyingtheerrormessage

Example

Generatearun-timeerroranddisplaythemessage"StrategyStopped":

RaiseRunTimeError("StrategyStopped");

446

RecalcLastBarAfter

Initializesthecalculationafterexpirationofthetimeout,setinseconds.Note:Themaximumrecalculationfrequencyis100milliseconds(0.1sec).

RecalcLastBarAfter(Timeout)

Where:Timeout-thenumberofseconds.

Example

RecalcLastBarAfter(60)willinitiatenewscriptcalculationafteroneminutetimeoutsincethelastcalculation.

447

ReCalculate

Initializesrecalculationofthestudy.Allthevariableswillbere-initialized.

Thestudywillberecalculatedfromthefirstbarofthedataseries.

Usage

ReCalculate

Note

Toavoidinfiniteloopingofthescript,useglobalvariableswithrecalculationconditions.

Example

Settheconditionforrecalculation:

Var:ReCalcPersistrecalc_once(True),vo10(0);

IfLastBarOnChartThenBeginPrint("Lastbarvolume=",Volume);

Ifrecalc_onceThenBeginPrint("Recalculatestudy!");recalc_once=FalseReCalculate;End;

End;

448

SetFPCompareAccuracy

Setsfloatingpointcompareaccuracybyspecifyingthetolerancevaluetobeusedwhenfloatingpointvaluesarecompared.

Twofloatingpointvalueswillbeconsideredequalif"abs(Value1Value2)<=ε",whereεisthetolerancevalue.

Bydefault,thetolerancevalueis2.2204460492503131e-012.

Usage

SetFPCompareAccuracy(Accuracy)

Parameters

Accuracy-anFPCconstantoranumericalexpressionspecifyingatolerancevalueasfollows:

fpcVeryLowAccuracy 0 02.2204460492503131e-8fpcLowAccuracy 1 12.2204460492503131e-10fpcMedAccuracy 2 22.2204460492503131e-12(Default)fpcHighAccuracy 3 32.2204460492503131e-14fpcVeryHighAccuracy 4 42.2204460492503131e-16fpcExact 5 50.00

Example

SetfloatingpointcompareaccuracytoHigh:

SetFPCompareAccuracy(3);

SetfloatingpointcompareaccuracytoHigh:

SetFPCompareAccuracy(fpcHighAccuracy);

449

#Return

ReturnsthecontrolfromthestudyscriptbyanalogywiththecorrespondingC++statement.

Doesnotreturnanyvalue.

Usage

#Return;

Notes

Canbeusedinalltypesofstudies.

450

AtCommentaryBarThisreservedwordreturnsavalueofTrueonthebarclickedbytheuser.

ItwillreturnavalueofFalseforallotherbars.

Thisallowsyoutooptimizeyourtradingstrategies,analysistechniques,andfunctionsforspeed,asitwillallowPowerLanguagetoskipallcommentary-relatedcalculationsforallbarsexceptfortheonewherethecommentaryisrequested.

Usage

AtCommentaryBar

Notes

ThedifferencebetweenAtCommentaryBarandCommentaryEnabledisthatCommentaryEnabledreturnsavalueofTrueforALLbarswhentheExpertCommentarywindowisopen,whiletheAtCommentaryBarreturnsavalueofTrueonlyforthebarclicked.

Example

Thefollowingstatementsdisplaya50-baraverageofthevolumeintheExpertCommentarywindowbutavoidcalculatingthis50-baraverageforeveryotherbarofthechart:

IfAtCommentaryBarThen

Commentary("The50-barvolavg:",Average(Volume,50));

451

CheckCommentaryReturnsTrueafterleftclickonachartwiththeExpertCommentarypointeronthespecifiedbar.

ReturnsFalseifthepointerhasnotbeeninserted,orifthepointerwasinsertedonadifferentbar.

Usage

CheckCommentary

Example

IfyouonlywantedcodetobeevaluatedforthebarwheretheuserhadinsertedtheExpertCommentaryTool,youcouldusethefollowingsyntax:

IfCheckCommentaryThenBegin{YourCodeHere}End;

452

CommentaryThisreservedwordsendstheexpression(orlistofexpressions)totheExpertCommentarywindowforwhateverbarisselectedonthepricechart.

Usage

Commentary("MyExpression");

Where"MyExpression"isthenumerical,textstringortrue/falseexpressionthatistobesenttotheExpertCommentarywindow.

Youcansendmultipleexpressions,commasmustseparatethem.

Example

Thefollowingwillresultinthestring"Thisisonelineofcommentary"beingsenttothecommentarywindow.

Anyadditionalcommentarysentwillbeplacedonthesameline.

Commentary("Thisisonelineofcommentary");

453

CommentaryCLThisreservedwordsendstheexpression(orlistofexpressions)totheExpertCommentarywindowforwhateverbarisselectedbytheExpertCommentarypointer.

Usage

CommentaryCL("MyExpression");

Where"MyExpression"isasingleoracomma-separatedlistofnumeric,textstring,ortrue/falseexpressionsthataresenttotheExpertCommentarywindow.

Example

Thefollowingwillresultinthestring"Thisisonelineofcommentary"beingsenttothecommentarywindow.

Anyadditionalcommentarysentwillbeplacedonthenextline.

CommentaryCL("Thisisonelineofcommentary");

454

CommentaryEnabledThisreservedwordreturnsavalueofTrueonlywhentheExpertCommentarywindowisopenandCommentaryhasbeenrequested.

Thisallowsyoutooptimizeyourtradingstrategies,analysistechniques,andfunctionsforspeed,asitallowsPowerLanguagetoperformcommentary-relatedcalculationsonlywhentheExpertCommentarywindowisopen.

Usage

CommentaryEnabled

Notes

ThedifferencebetweenCommentaryEnabledandAtCommentaryBaristhatCommentaryEnabledreturnsavalueofTrueforALLbarswhentheExpertCommentarywindowisopen,whiletheAtCommentaryBarreturnsavalueofTrueonlyforthebarclickedwiththeExpertCommentarypointer.

Example

CommentaryEnabledwillreturnTrueiftheAnalysisCommentaryToolhasbeenappliedtothechart.

455

#BeginCmtryThestatementsbetweenthiscompilerdirectiveandthereservedword#EndareevaluatedonlywhentheExpertCommentarytoolisusedtoselectabaronachartoracellinagrid.

Thereservedword#Endmustbeusedwiththisreservedword.

Usage

#BeginCmtry

Commentary("Theindicatorvaluehereis"+NumtoStr(Plot1,2));

#End;

Notes

Allstatementsbetweenthe#BeginCmtryand#Endareignored,includingcalculationofMaxBarsBack,unlesscommentaryisgenerated.

Example

Anindicatorthatcalculatesthe10-barmomentumoftheclosingpriceneedstenbarsinordertostartplottingresults.

Ifcommentaryisaddedtothisindicatorandthecommentaryusesa50-baraverageofthevolume,thentheMaxBarsBacksettingisincreasedtofifty.

However,the50-baraverageisonlyusedforthecommentary,sothereisnoneedtohavetheindicatorwaitfiftybarsbeforegivingresultsunlessCommentaryisrequested.

Tohavetheindicatorplotafter10barsandignorethe50-barrequirement,theindicatorcanbewrittenasfollows:

Plot1(Close-Close[10],"Momentum");

456

#BeginCmtry;IfClose-Close[10]>0ThenCommentary("Momentumispositive,")ElseCommentary("Momentumisnegative,");IfVolume>Average(Volume,50)ThenCommentary("andvolumeisgreaterthanaverage.")ElseCommentary("andvolumeislowerthanaverage.");#End;

Thisindicatorplotsthemomentumandthecommentarystateswhetherthemomentumispositiveornegative,andifthevolumeisoverorunderthe50-baraverageofthevolume.

Whentheindicatorisappliedwithoutusingcommentary,itwillrequireonly10barstostartcalculating.

Whencommentaryisrequested,theindicatorisrecalculated,thestatementswithinthecompilerdirectivesareevaluated,andthenewminimumnumberofbarsrequiredis50.

Anyseriesfunctionswithinthesereservedwordsarealsoignored.

457

AbsValueReturnstheabsolutevalueofthespecifiednumericalexpression.

Usage

AbsValue(Value)

Where:Value-anumericalexpression

Example

AbsValue(45.275)willreturnavalueof45.275

AbsValue(-1385)willreturnavalueof1385

458

ArcTangentReturnsthearctangentvalue,indegrees,ofthespecifiednumericalexpression.

Usage

ArcTangent(Value)

Where:Value-anumericalexpression

Example

ArcTangent(2.318)willreturnavalueof66.66

459

AvgListReturnstheaveragevalueofthespecifiednumericalexpressions.

Usage

AvgList(Value1,Value2,Value3,etc.)

Where:Value1,Value2,Value3,etc.-numericalexpressions

Example

AvgList(45,40,0,35)willreturnavalueof30

AvgList(-40,20)willreturnavalueof-10

460

CeilingReturnsthesmallestintegergreaterthanorequaltothespecifiednumericalexpression.

Usage

Ceiling(Value)

Where:Value-anumericalexpression

Example

Ceiling(9.1)willreturnavalueof10

Ceiling(-2.85)willreturnavalueof-2

461

CosineReturnsthecosinevalueforanangleofthespecifiednumberofdegrees.

Usage

Cosine(Value)

Where:Value-anumericalexpression,specifyingthenumberofdegreesintheangle

Example

Cosine(60)willreturnavalueof0.5

462

CotangentReturnsthecotangentvalueforanangleofthespecifiednumberofdegrees.

Usage

Cotangent(Value)

Where:Value-anumericalexpression,specifyingthenumberofdegreesintheangle

Example

Cotangent(30)willreturnavalueof1.732

463

ExpValueReturnstheexponentialvalueofthespecifiednumericalexpression.

Usage

ExpValue(Value)

Where:Value-anumericalexpression

Example

ExpValue(2.3)willreturnavalueof9.0250

464

FloorReturnsthegreatestintegerlessthanorequaltothespecifiednumericalexpression.

Usage

Floor(Value)

Where:Value-anumericalexpression

Example

Floor(9.1)willreturnavalueof9

Floor(-2.85)willreturnavalueof-3

465

FracPortionReturnsthefractionalportionofthespecifiednumericalexpressionwhileretaingthesign.

Usage

FracPortion(Value)

Where:Value-anumericalexpression

Example

FracPortion(-45.275)willreturnavalueof-0.275

FracPortion(1385)willreturnavalueof0

466

IntPortionReturnstheintegerportionofthespecifiednumericalexpressionwhileretaingthesign.

Usage

IntPortion(Value)

Where:Value-anumericalexpression

Example

IntPortion(-45.75)willreturnavalueof-45

IntPortion(1385)willreturnavalueof1385

467

LogReturnsthenaturallogarithmofthespecifiednumericalexpression.

Usage

Log(Value)

Where:Value-anumericalexpression

Example

Log(25)willreturnavalueof3.2189

468

MaxListReturnsthevalueofthegreatestofthespecifiednumericalexpressions.

Usage

MaxList(Value1,Value2,Value3,etc.)

Where:Value1,Value2,Value3,etc.-numericalexpressions

Example

MaxList(-5,0,12,7)willreturnavalueof12

469

MaxList2Returnsthesecondhighestvalueofthespecifiednumericalexpressions.

Usage

MaxList2(Value1,Value2,Value3,etc.)

Where:Value1,Value2,Value3,etc.-numericalexpressions

Example

MaxList2(-5,0,12,7)willreturnavalueof7

470

MinListReturnsthelowestvalueofthespecifiednumericalexpressions.

Usage

MinList(Value1,Value2,Value3,etc.)

Where:Value1,Value2,Value3,etc.-numericalexpressions

Example

MinList(-5,0,12,7)willreturnavalueof-5

471

MinList2Returnsthesecondlowestvalueofthespecifiednumericalexpressions.

Usage

MinList2(Value1,Value2,Value3,etc.)

Where:Value1,Value2,Value3,etc.-numericalexpressions

Example

MinList(-5,0,12,7)willreturnavalueof0

472

ModReturnstheremainderfromdividingonespecifiednumericalexpressionbyanother.

Usage

Mod(Dividend,Divisor)

Where:Dividend-anumericalexpressionDivisor-anumericalexpression

Example

Mod(25,7)willreturnavalueof4

473

NegReturnsthenegativeabsolutevalueofthespecifiednumericalexpression.

Usage

Neg(Value)

Where:Value-anumericalexpression

Example

Neg(12)willreturnavalueof-12

Neg(-7)willreturnavalueof-7

474

NthMaxListReturnstheNthhighestvalueofthespecifiednumericalexpressions.

Usage

NthMaxList(N,Value1,Value2,Value3,etc.)

Where:N-anumericalexpression,indicatingtherankofthevaluetobereturnedValue1,Value2,Value3,etc.-numericalexpressions

Example

NthMaxList(4,-15,-5,0,6,12)willreturnavalueof-5

475

NthMinListReturnstheNthlowestvalueofthespecifiednumericalexpressions.

Usage

NthMinList(N,Value1,Value2,Value3,etc.)

Where:N-anumericalexpression,indicatingtherankofthevaluetobereturnedValue1,Value2,Value3,etc.-numericalexpressions

Example

NthMinList(4,-15,-5,0,6,12)willreturnavalueof6

476

PosSameasAbsValue

477

PowerReturnsthevalueofonespecifiednumericalexpressiontothepowerofanother.

Usage

Power(Base,Exponent)

Where:Base-anumericalexpressionExponent-anumericalexpression

Example

Power(5,3)willreturnavalueof125

478

RandomReturnsapseudo-randomnumberbetween0andthevalueofthespecifiednumericalexpression.

Usage

Random(Value)

Where:Value-anumericalexpression

Example

Random(1.25)willreturnarandomvalueanywherebetween0and1.25

Random(-10)willreturnarandomvalueanywherebetween-10and0

479

RoundReturnsthevalueofonespecifiednumericalexpressionroundedtothenumberofdecimalplacesspecifiedbyanother.

Usage

Round(Value,Precision)

Where:Value-anumericalexpressionPrecision-anumericalexpression

Example

Round(1.237,2)willreturnavalueof1.24

Round(-5.7744,3)willreturnavalueof5.774

480

SignReturnsanumericalvalue,indicatingthesignofthevalueofthespecifiednumericalexpression.

Avalueof1isreturnedforapositivevalue,-1isreturnedforanegativevalue,and0isreturnedforthevalueof0.

Usage

Sign(Value)

Where:Value-anumericalexpression

Example

Sign(5)willreturnavalueof1

Sign(-2.85)willreturnavalueof-1

Sign(0)willreturnavalueof0

481

SineReturnsthesinevalueforanangleofthespecifiednumberofdegrees.

Usage

Sine(Value)

Where:Value-anumericalexpression,specifyingthenumberofdegreesintheangle

Example

Sine(30)willreturnavalueof0.5

482

SquareReturnsthesquareofthevalueofthespecifiednumericalexpression.

Usage

Square(Value)

Where:Value-anumericalexpression

Example

Square(2.5)willreturnavalueof6.25

483

SquareRootReturnsthesquarerootofthevalueofthespecifiednumericalexpression.

Usage

SquareRoot(Value)

Where:Value-anumericalexpression

Example

SquareRoot(57.73)willreturnavalueof7.598

484

SumListReturnsasumofthevaluesofthespecifiednumericalexpressions.

Usage

SumList(Value1,Value2,Value3,etc.)

Where:Value1,Value2,Value3,etc.-numericalexpressions

Example

SumList(45,-20,0,35)willreturnavalueof60

485

TangentReturnsthetangentvalueforanangleofthespecifiednumberofdegrees.

Usage

Tangent(Value)

Where:Value-anumericalexpression,specifyingthenumberofdegreesintheangle

Example

Tangent(40)willreturnavalueof0.839

486

AgoUsedincombinationwithBarorBarsandanumericalexpressiontoreferencethebaraspecifiednumberofbarsbackfromthecurrentbar.

BarsAgocanalsobespecifiedbyusingthebaroffsetnotationthatconsistsofanumericalexpressionenclosedinsquarebrackets.

Usage

NBarsAgo

or:

[N]

Where:N-anumericalexpressionspecifyingthenumberofbarsbacktoreference

Example

Plottheclosingpriceofthepreviousbar:

Plot1(CloseOf1BarAgo,"Previousbar'sclose");

Plottheclosingpriceoftwobarsago:

Plot1(Close[2],"Close2barsago");

487

BarUsedincombinationwithThis,Next,orAgotoreferenceaspecificbar.

Usage

Bar

Example

CloseOf1BarAgowillreturntheclosingpriceofthepreviousbar

Buyauser-setnumberofsharesoncloseofthisbar:

BuyThisBarOnClose;

Buyauser-setnumberofsharesonopenofnextbar:

BuyNextBarOnOpen;

488

BarsSameasBar

489

ContractSameasContracts

490

ContractsUsedinstrategyentryorexitstatementsincombinationwithanumericalexpressiontospecifythenumberofcontractsorsharestotrade.

Usage

TradeSizeContracts

Where:TradeSize-anumericalexpression,specifyingthenumberofcontractsorshares

Example

Buy2contractsatMarketpriceonopenofnextbar:

Buy2ContractsNextBarAtMarket;

491

MarketUsedinstrategyentryorexitstatementstospecifyaMarketpriceforanentryoranexit.

AMarketBuyorderwillexecuteatthecurrentaskpriceandaMaretSellorderwillexecuteatthecurrentbidprice.

Usage

AtMarket

Where:Atisaskipwordandcanbeomitted

Example

Buyauser-setnumberofsharesatMarketpriceonopenofnextbar:

BuyNextBarAtMarket;

492

NextUsedincombinationwithBartoreferencethenextbar.

Usage

NextBar

Example

Buyauser-setnumberofsharesatMarketpriceonopenofnextbar:

BuyNextBarAtMarket;

493

ThisUsedincombinationwithBartoreferencethecurrentbar.

Usage

ThisBar

Example

Buyauser-setnumberofsharesoncloseofthisbar:

BuyThisBarOnClose;

494

TodayRetainedforbackwardcompatibility;replacedwithThisBar

495

YesterdayRetainedforbackwardcompatibility.

496

MouseClickBarNumber

Afteramouseclickonthebar,returnsthenumericalvalueindicatingthebarnumberfromthebeginningofthedataseries.

Usage

MouseClickBarNumber

Example

MouseClickBarNumber-willreturn250afteramouseclickonthe250thbaronthechartfromthebeginningofthedataseries.

497

MouseClickCtrlPressed

ReturnsTrueiftheCtrlbuttonispressedonthekeyboardsimultaneouslywithamouseclick.

Usage

MouseClickCtrlPressed

498

MouseClickDataNumber

Returnsthenumericalvalueindicatingthedataseriesnumberafteramouseclickonthedataseries.

Usage

MouseClickDataNumber

Example

MouseClickDataNumber-willreturn1afterleft-clickonthemainchartwiththemaindataseries.

MouseClickDataNumber-willreturn2afterleft-clickonthesub-chartwiththeseconddataseries.

499

MouseClickDateTime

Returnsadouble-precisiondecimalvalueinJulian(OLE)date-timeformatindicatingtheclosingdateofthebarafteraclickonthebar.

Usage

MouseClickDateTime

Example

MouseClickDateTime-willreturnavalueof39449.65625000for3:45PM.

500

MouseClickPrice

Returnsanumericalvalueindicatingpricelevelofthemousepointerpositionafteraclickonthechart.

Usage

MouseClickPrice

Example

MouseClickPrice-willreturn139.60afteraclickonthechartonthe139.60pricelevel.

501

MouseClickShiftPressed

ReturnsTrueiftheShiftbuttonispressedonthekeyboardsimultaneouslywithamouseclick.

Usage

MouseClickShiftPressed

502

PlaySoundPlaysthespecifiedwave(.wav)soundfile.

Usage

PlaySound("PathFilename")

Where:PathFilename-astringexpressionspecifyingthepathandfilenameofthewavefiletobeplayed

Example

Playding.wavsoundfilelocatedintherootdirectoryoftheC:harddrive:

PlaySound("C:\ding.wav");

503

ClearDebugClearsthePowerLanguageEditorOutputLog.

Usage

ClearDebug

Example

ClearDebug;willclearthePowerLanguageEditorOutputLog

504

ClearPrintLogSameasClearDebug

505

FileUsedinPrintstatementstospecifyanASCIIfileastheoutputlocation;mustprecedetheexpressionstobeprintedandbefollowedbyacomma.Ifthespecifiedfiledoesnotexist,thefilewillbecreated.

Usage

File("PathFilename")

Where:PathFilename-astringexpressionspecifyingthepathandfilename

Example

Print(File("C:\test.txt"),CurrentDate,CurrentTime);willsavetheoutputofCurrentDateandCurrentTimetothetest.txtfileintherootdirectoryoftheC:harddrive

506

FileAppendAppendsthespecifiedstringexpressiontotheendofthespecifiedASCIIfile;ifthespecifiedfiledoesnotexist,thefilewillbecreated.

Usage

FileAppend("PathFilename","StringExpression")

Where:PathFilename-astringexpressionspecifyingthepathandfilenameStringExpression-thestringexpressiontobeappendedtoafile

Example

FileAppend("C:\test.txt","AppendedText");willappendthestringexpression"AppendedText"totheendofthetest.txtfileintherootdirectoryoftheC:harddrive

507

FileDeleteDeletesthespecifiedfile.

Usage

FileDelete("PathFilename")

Where:PathFilename-astringexpressionspecifyingthepathandfilenameofthefiletobedeleted

Example

FileDelete("C:\test.txt");willdeletethefiletest.txtintherootdirectoryoftheC:harddrive

508

MessageLogDisplaysoneormorespecifiedexpressionsinthePowerLanguageEditorOutputLog.Anycombinationofstring,true/false,numericalseries,ornumericalexpressionscanbespecified.

Usage

MessageLog(Expression1,Expression2,etc.)

Parameters

Expression-astring,true/false,numericalseries,ornumericalexpression;anynumberofvalidexpressions,separatedbycommas,canbeused

Astringexpressionmustbeenclosedinquotationmarks:

"StringExpression"

Anumericalexpressioncanbeformattedtospecifytheminimumnumberofcharacters,includingthedecimalpoint,andthenumberofdecimalplaces,tobeusedfortheoutput:

Expression:C:D

Where:C-minimumnumberofcharactersD-numberofdecimalplaces

Thedefaultoutputformatforanumericalexpressionistwodecimalplacesandaminimumofsevencharacters.

Ifthenumberofdecimalplacesinthenumericalexpressionismorethanthespecifiednumber,thevaluewillbewillberoundedofftothespecifiednumberofdecimalplaces.

Ifthenumberofcharactersintheoutputislessthanthespecifiedminimum,leadingspaceswillbeaddedtobringtheoutputtothespecifiedminimumvalue.

509

Example

MessageLog(.1);willdisplay0.10inthePowerLanguageEditorOutputLog,withthreeleadingspacesinserted

MessageLog(1.555555:6:3);willdisplay1.556inthePowerLanguageEditorOutputLog,withoneleadingspaceinserted

MessageLog("CurrentTimeis:",CurrentTime:5:0);willdisplaythestringexpression"CurrentTimeis:",followedbytheoutputoftheCurrentTime,withoneleadingspaceinserted,inthePowerLanguageEditorOutputLog

510

PrintSendsoneormorespecifiedexpressionstothePowerLanguageEditorOutputLogoranotheroutputtarget,ifspecified.Anycombinationofstring,true/false,numericalseries,ornumericalexpressionscanbespecified.

Usage

Print([OutputTarget],Expression1,Expression2,etc.)

ParameterinsidethesquarebracketsisoptionalParameters

OutputTarget-anoptionalparameter;specifiesanoutputtargetotherthenthePowerLanguageEditorOutputLog;theparametermustbefollowedbyacomma.

Therearetwooptionaloutputtargets:

Printer

Specifiesthedefaultprinterastheoutputtarget.

File("PathFilename")

Where:PathFilename-astringexpressionspecifyingthepathandfilename

SpecifiesanASCIIfileastheoutputtarget;ifthespecifiedfiledoesnotexist,thefilewillbecreated.

IfOutputTargetisnotspecified,theoutputwillbesenttothePowerLanguageEditorOutputLog.

Expression-astring,true/false,numericalseries,ornumericalexpression;anynumberofvalidexpressions,separatedbycommas,canbeused

Astringexpressionmustbeenclosedinquotationmarks:

"StringExpression"

511

Anumericalexpressioncanbeformattedtospecifytheminimumnumberofcharacters,includingthedecimalpoint,andthenumberofdecimalplaces,tobeusedfortheoutput:

Expression:C:D

Where:C-minimumnumberofcharactersD-numberofdecimalplaces

Thedefaultoutputformatforanumericalexpressionistwodecimalplacesandaminimumofsevencharacters.

Ifthenumberofdecimalplacesinthenumericalexpressionismorethanthespecifiednumber,thevaluewillbewillberoundedofftothespecifiednumberofdecimalplaces.

Ifthenumberofcharactersintheoutputislessthanthespecifiedminimum,leadingspaceswillbeaddedtobringtheoutputtothespecifiedminimumvalue.

Example

Print(.1);willprint0.10inthePowerLanguageEditorOutputLog,withthreeleadingspacesinserted

Print(1.555555:6:3);willprint1.556inthePowerLanguageEditorOutputLog,withoneleadingspaceinserted

Print(Printer,"PrintTest");willsendthestringexpression"PrintTest"tothedefaultprinter

Print(File("C:\test.txt"),CurrentDate,CurrentTime);willsavetheoutputofCurrentDateandCurrentTimetothetest.txtfileintherootdirectoryoftheC:harddrive

512

DefaultUsedinplotstatementstospecifyadefaultstyle.Defaultstylesaresetbytheuser.

FormoreinformationseePlot

Usage

Default

Example

Plottheclosingpriceusingthedefaultstyles(colorandwidth):

Plot1(Close,"Close",Default,Default,Default);

513

GetBackgroundColor

ReturnsanRGBcolornumberoralegacycolorvaluethatcorrespondtothebackgroundcolorofthechart.

Usage

GetBackgroundColor

Example

AssignanRGBcolornumber,correspondingtothebackgroundcolorofthechart,toValue1variable:

Value1=GetBackgroundColor;

Assignalegacycolorvalue,correspondingtothebackgroundcolorofthechart,toValue1variable:

[LegacyColorValue=True];

Value1=GetBackgroundColor;

514

GetPlotBGColor

Returnsthenumericcolorvalueoftheplot(cell)backgroundinagrid.

Usage

GetPlotBGColor(PlotNum)

Where:PlotNum-numericalexpressionrepresentingplotnumber

Example

Setavariable,Value1,tothecellcolorofthePlot1background:

Value1=GetPlotBGColor(1);

515

GetPlotColor

ReturnsanRGBcolornumberoralegacycolorvaluethatcorrespondtothecolorofthespecifiedplot.

Usage

GetPlotColor(PlotNumber)

Where:PlotNumber-anumericalexpressionspecifyingtheplotnumber;plotnumbersrangefrom1to999

Example

AssignanRGBcolornumber,correspondingtothecolorofPlot1,toValue1variable:

Value1=GetPlotColor(1);

Assignalegacycolorvalue,correspondingtothecolorofPlot1,toValue1variable:

[LegacyColorValue=True];

Value1=GetPlotColor(1);

516

GetPlotWidth

Returnstheplotlinewidthvalueofthespecifiedplot.Plotlinewidthvaluesrangefrom0to14.

Usage

GetPlotWidth(PlotNumber)

Where:PlotNumber-anumericalexpressionspecifyingtheplotnumber;plotnumbersrangefrom1to999

Example

AssigntheplotlinewidthvalueofPlot1toValue1variable:

Value1=GetPlotWidth(1);

517

I_getplotvalue

Getsthevaluecalculatedbyasignalthatistobeusedforplottingfromanindicator.Itcanbeconsideredasabridgebetweenasignalandanindicator.Usingi_setplotvalueandi_getplotvaluekeywordsmakesitpossibletoavoidcopyingthesamescriptforcalculationthesamevalueinbothindicatorandsignal.

Usage

i_getplotvalue(index)

Parameters

index-isthereferencenumber

Notes

1. i_getplotvaluecanbeusedinfunctionsandindicatorsifanysignalisappliedtothemainchart.

2. Valueswillbetransferredbetweeni_setplotvalueandi_getplotvalueONLYwithin1chartwindow,

3. i_setplotvalueandi_getplotvaluewillreturn0ifappliedtotheMarketScannerWindow,

4. i_setplotvalueandi_getplotvaluecannotbeusedwhilebacktestingaportfolio,

5. i_setplotvalueandi_getplotvaluecannotbereferredhistorically,

6. itispossibletouseunlimitedindexesfordatatransfer.

Usage

Plotintheindicatorthemaxdrawdownandopenequityvaluescalculatedbythesignalwithindexes111and112

518

plot1(i_getplotvalue(111),"MaxIDDrawdown");

plot2(i_getplotvalue(112),"OpenEquity");

519

I_setplotvalue

Setsthevaluecalculatedbyasignalthatistobeusedforplottingfromanindicator.Itcanbeconsideredasabridgebetweenasignalandanindicator.Usingi_setplotvalueandi_getplotvaluekeywordsmakesitpossibletoavoidcopyingthesamescriptforcalculationthesamevalueinbothindicatorandsignal.

Usage

i_setplotvalue(index,value)

Parameters

index-isthereferencenumber

value-isthevaluethatistobetransferred.

Notes

1. i_setplotvaluecanbeusedinsignals,functionsand

indicatorsifanysignalisappliedtothemainchart.

2. Valueswillbetransferredbetweeni_setplotvalueandi_getplotvalueONLYwithin1chartwindow,

3. i_setplotvalueandi_getplotvaluewillreturn0ifappliedtotheMarketScannerWindow,

4. i_setplotvalueandi_getplotvaluecannotbeusedwhilebacktestingaportfolio,

5. i_setplotvalueandi_getplotvaluecannotbereferredhistorically,

6. itispossibletouseunlimitedindexesfordatatransfer.

Usage

520

Setthemaxdrawdownandopenequityvaluescalculatedbythesignaltobetransferredintotheindicatorwithindexes111and112

i_setplotvalue(111,maxiddrawdown)

i_setplotvalue(112,netprofit+openpositionprofit)

521

NoPlotRemovesaspecifiedplotfromthecurrentbar.

Aconditionalplotthatisalreadydrawnwillremaineveniftheconditionsbecomenolongertruebeforethebarisclosed.NoPlotcanbeusedtoremovetheconditionalplotfromthecurrentbariftheconditionsarenolongertrue.

Usage

NoPlot(PlotNumber)

Where:PlotNumber-anumericalexpressionspecifyingtheplotnumber;plotnumbersrangefrom1to999

Example

TheexamplebelowusesNoPlotremovethePlotPaintBarplot"painted"overthechartsbarsforwhichtheHighpriceisnolongerlessthentheHighpriceofthepreviousbar:

IfHigh<High[1]ThenBeginPlotPaintBar(High,Low,"",Red);End

ElseBeginNoPlot(1);NoPlot(2);End;

WithoutNoPlot,chartsbarsforwhichaHighpricewasinitiallylessthentheHighpriceofthepreviousbarwouldremainpartiallypaintedevenifaHighpriceequaltoorgreaterthentheHighpriceofthepreviousbarwasreachedbeforethebarwasclosed.

522

PlotPlotsthespecifiednumericalorstringexpressiononachart,upto999differentplotscanbeusedsimultaneously.

Numerical:Plotoffset,name,color,andplotlinewidthcanbespecifiedbyusingtheoptionalparameters.

String:Abilitytoshowauser-definedtextmessageonthestatuslineofthechartorinthescanner.

Usage

Numerical:PlotN<[Offset]>(Expression<,"PlotName"<,PlotColor<,ScannerCellBackgroundColor<,LineWidth>>>>)

Text:PlotN("String")

Parametersinsidetheangledbracketsareoptional

Parameters

N-anumberusedtoidentifytheplot;plotnumberscanrangefrom1to999

Offset-anoptionalparameter;anumericalexpressionspecifyingtheplotoffset,inbars;apositivevaluewilldisplacetheplottotheleftalongthetimeaxis,andanegativevaluewilldisplacetheplottotherightalongthetimeaxis

Expression-thenumericalexpressiontobeplotted

PlotName-anoptionalparameter;assignsanametotheplot

PlotColor-anoptionalparameter;specifiestheplotcolorPlotcolorcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumberoralegacycolorvalue,byoneof17basecolorwords,orbythewordDefaulttospecifythecolorchosenbytheuser.InorderforPlotColortobeused,PlotNameparametermustalsobeused.

ScannerCellBackgroundColor-anoptionalparameter;setsthebackgroundcolorofthescannercellifthisplotisappliedtoascanner;usethewordDefault

523

tospecifythecolorchosenbytheuser.InorderforScannerCellBackgroundColortobeused,PlotNameandPlotColorparametersmustalsobeused.

LineWidth-anoptionalparameter;specifiestheplotlinewidth,rangingfrom1to14PlotlinewidthcanbespecifiedasanumericalexpressionorbythewordDefaulttospecifythelinewidthchosenbytheuser.InorderforLineWidthtobeused,PlotName,PlotColor,andScannerCellBackgroundColorparametersmustalsobeused.

String-texttobedisplayed

Example

Plottheclosingpriceusingthedefaultplotcolorandlinewidth:

Plot1(Close);

Plottheclosingpriceusingthedefaultplotcolorandlinewidth,andnametheplot"Close":

Plot1(Close,"Close",Default,Default,Default);

Plottheclosingprice,offsetbackby3bars,usingtheplotcolorofblue,usingcellbackgroundcolorofgreenifthisplotisappliedtoascanner,linewidthof3,andnametheplot"Close3barslater":

Plot1[3](Close,"Close3barslater",Blue,Green,3);

Plottheclosingprice,offsetforwardby3bars,usingtheRGBcolor2138336(Orange),andnametheplot"Close3barsago":

Plot1[-3](Close,"Close3barsago",2138336);

Plottheclosingpriceusingthelegacycolorvalueof4(Green)andnametheplot"Close":

[LegacyColorValue=True];Plot1(Close,"Close",4);

Showthetext"Attention!"onthestatusbarofthechartorinthescanner.

524

Plot1("Attention!");

Showthetext"Attention!"onthestatusbarofthechartorinthescanneriftheclosepriceisgreaterthan100.Ifclose>100thenPlot1("Attention!");

525

PlotPaintBarPlotsthespecifiednumericalexpressionsintheformofabarchart.

Plotname,color,andplotlinewidthcanbespecifiedbyusingtheoptionalparameters.

PlotPaintBarplotcanbesuperimposedontopofoneormorebarsofabarchart,effectively"painting"thebars.

Usage

PlotPaintBar(BarHigh,BarLow,BarOpen,BarClose<,"PlotName"<,PlotColor<,Default<,LineWidth>>>>)

Parametersinsidetheangledbracketsareoptional

Parameters

BarHigh,BarLow,BarOpen,BarClose-numericalexpressionsspecifyingtheHigh,Low,Open,&Closepricesforthebarstobeplotted;atleasttwooftheseparametersarerequired

PlotName-anoptionalparameter;assignsanametotheplot

PlotColor-anoptionalparameter;specifiestheplotcolorPlotcolorcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumberoralegacycolorvalue,byoneof17basecolorwords,orbythewordDefaulttospecifythecolorchosenbytheuser.InorderforPlotColortobeused,PlotNameparametermustalsobeused.

Default-anoptionalparameterreservedforfutureuse;shouldbespecifiedasDefault;useofthisparameterisrequiredinorderforLineWidthtobeused

LineWidth-anoptionalparameter;specifiestheplotlinewidth,rangingfrom1to14PlotlinewidthcanbespecifiedasanumericalexpressionorbythewordDefaulttospecifythelinewidthchosenbytheuser.InorderforLineWidthtobeused,PlotName,PlotColor,andDefaultparametersmustalsobeused.

526

Notes

PlotPaintBar(BarHigh,BarLow,BarOpen,BarClose);

istheequivalentof:

Plot1(BarHigh);Plot2(BarLow);Plot3(BarOpen);Plot4(BarClose);

InorderforthePlotPaintBarplottobedisplayedintheformofabarchart,theplottypeforeachPlotmustbeset,intheStylesectionoftheGeneraltaboftheFormatIndicatorwindow,toBarHigh,BarLow,LeftTick,andRightTick,respectively.

Example

PaintredthesebarsofanOHLCchartforwhichtheOpenpriceislessthentheOpenpriceofthepreviousbar:

IfOpen<Open[1]ThenPlotPaintBar(High,Low,Open,Close,"",Red);

527

PlotPBSameasthePlotPaintBar

528

SetPlotBGColorAssignsaspecifiedcolortothecellbackgroundfortheindicatedstudyplotforthedurationofthecurrentbar.

UseofSetBGPlotColoriseffectiveonlyfortheScanner.

Usage

SetPlotBGColor(PlotNumber,PlotColor)

Parameters

PlotNumber-anumericalexpressionspecifyingtheplotnumber;plotnumbersrangefrom1to999

PlotColor-anexpressionspecifyingthecellbackgroundcolorfortheindicatedplot.CellbackgroundcolorfortheindicatedplotcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumber,alegacycolorvalue,orbyoneof17basecolorwords.

Example

Assignthecolorofbluetotheindicatedcelloftheplot1forthedurationofthecurrentbar:

SetPlotBGColor(1,Blue);

AssignRGBcolor2138336(Orange)totheindicatedcelloftheplot1forthedurationofthecurrentbar:

SetPlotColor(1,2138336);

Assignlegacycolor4(Green)totheindicatedcelloftheplot1forthedurationofthecurrentbar:

[LegacyColorValue=True];SetPlotBGColor(1,4);

529

530

SetPlotColor

Assignsaspecifiedcolortothespecifiedplotforthedurationofthecurrentbar.

Usage

SetPlotColor(PlotNumber,PlotColor)

Parameters

PlotNumber-anumericalexpressionspecifyingtheplotnumber;plotnumbersrangefrom1to999

PlotColor-anexpressionspecifyingtheplotcolor

PlotcolorcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumberoralegacycolorvalue,orbyoneof17basecolorwords.

Example

Assignthecolorofbluetoplot1forthedurationofthecurrentbar:

SetPlotColor(1,Blue);

AssignRGBcolor2138336(Orange)toplot1forthedurationofthecurrentbar:

SetPlotColor(1,2138336);

Assignlegacycolor4(Green)toplot1forthedurationofthecurrentbar:

[LegacyColorValue=True];SetPlotColor(1,4);

531

SetPlotWidth

Assignsaspecifiedlinewidthtothespecifiedplotforthedurationofthecurrentbar.

Usage

SetPlotWidth(PlotNumber,LineWidth)

Where:PlotNumber-anumericalexpressionspecifyingtheplotnumber;plotnumbersrangefrom1to999LineWidth-anumericalexpressionspecifyingtheplotlinewidth;linewidthcanrangefrom1to14

Example

Assignaplotlinewidthof10toplot1forthedurationofthecurrentbar:

SetPlotWidth(1,10);

532

pmms_get_strategy_named_numReturnsanumericalvalue,indicatingthevalueofVariableNameofthestrategywithStrategyIndexnumber.

Usage

pmms_get_strategy_named_num(StrategyIndex,VariableName)

Parameters

StrategyIndex-numericvariable.

VariableName-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_get_strategy_named_num(0,"CustomVar")

533

pmms_get_strategy_named_strReturnsastringvalue,indicatingthevalueofVariableNameofthestrategywithStrategyIndexnumber.

Usage

pmms_get_strategy_named_str(StrategyIndex,VariableName)

Parameters

StrategyIndex-numericvariable.

VariableName-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_get_strategy_named_str(0,"CustomStr")

534

pmms_set_strategy_named_numThisfunctionsetsthevalueofVariableNameofthestrategywithStrategyIndexnumber.

Usage

pmms_set_strategy_named_num(StrategyIndex,VariableName,VariableValue)

Parameters

StrategyIndex-numericvariable.

VariableName-stringvariable.

VariableValue-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_set_strategy_named_num(0,"CustomVar",5)

535

pmms_set_strategy_named_strThisfunctionsetsthestringvalueofVariableNameofthestrategywithStrategyIndexnumber.

Usage

pmms_set_strategy_named_str(StrategyIndex,VariableName,VariableValue)

Parameters

StrategyIndex-numericvariable.

VariableName-stringvariable.

VariableValue-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_set_strategy_named_str(0,"CustomStr","buy")

536

pmms_strategies_allow_entries_allThisfunctionallowsallthestrategiestoopenpositions.

Usage

pmms_strategies_allow_entries_all

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategies_allow_entries_all

537

pmms_strategies_countReturnsanumericalvalue,indicatingthenumberoftradingstrategies(whichisequaltonumberofdownloadedinstrumentsthataretraded).

Usage

pmms_strategies_count

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategies_count

538

pmms_strategies_deny_entries_allThisfunctiondeniesallthestrategiestoopenpositions(entryorderswillbeexcludedfromRAWorderscollection).

Usage

pmms_strategies_deny_entries_all

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategies_deny_entries_all

539

pmms_strategies_get_by_symbol_nameReturnsanindexofthestrategybasedoninstrumentname(-1,iftheinstrumentisnotfound).Ifseveralstrategiesareappliedtothesameinstrument,thenthenumberofoneofthesestrategieswillbereturned.

Usage

pmms_strategies_get_by_symbol_name(SymbolName)

Parameters

SymbolName-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Value1=pmms_strategies_get_by_symbol_name("MSFT");

540

pmms_strategies_in_long_countReturnsanumericalvalue,indicatingthenumberofstrategieswithopenlongposition.Acceptsoneparameter-aonedimensionaldynamicalarray.Thisarrayisfilledwiththeindexnumbersofthestrategiesthathaveanopenlongpositionatthemomentofthestrategycalculation.

Usage

pmms_strategies_in_long_count(indexesArray)

Parameters

indexesArray-arrayvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

var:positionsLong(0);

array:strategyIndexes[](0);

positionsLong=pmms_strategies_in_long_count(strategyIndexes);

541

pmms_strategies_in_positions_countReturnsanumericalvalue,indicatingthenumberofstrategieswithopenposition.Acceptsoneparameter-aonedimensionaldynamicalarray.Thisarrayisfilledwiththeindexnumbersofthestrategiesthathaveanopenpositionatthemomentofthestrategycalculation.

Usage

pmms_strategies_in_positions_count(indexesArray)

Parameters

indexesArray-arrayvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

var:positions(0);

array:strategyIndexes[](0);

positions=pmms_strategies_in_positions_count(strategyIndexes);

542

pmms_strategies_in_short_countReturnsanumericalvalue,indicatingthenumberofstrategieswithopenshortposition.Acceptsoneparameter-aonedimensionaldynamicalarray.Thisarrayisfilledwiththeindexnumbersofthestrategiesthathaveanopenshortpositionatthemomentofthestrategycalculation.

Usage

pmms_strategies_in_short_count(indexesArray)

Parameters

indexesArray-arrayvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

var:positionsShort(0);

array:strategyIndexes[](0);

positionsShort=pmms_strategies_in_short_count(strategyIndexes);

543

pmms_strategies_pause_allThisfunctionpausesordersendingforallstrategiesoftheportfolio.

Usage

pmms_strategies_pause_all

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategies_pause_all

544

pmms_strategies_resume_allThisfunctionresumesordersendingforallstrategiesoftheportfolio.

Usage

pmms_strategies_resume_all

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategies_resume_all

545

pmms_strategies_set_status_for_allThisfunctionsetsatext(string)statusforallstrategiesoftheportfolio(statusisindicatedintheCustomTextcolumnofPortfolioReal-TimeWindow).

Usage

pmms_strategies_set_status_for_all(Status)

Parameters

Status-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategies_set_status_for_all("Calculating")

546

pmms_strategy_allow_entriesThisfunctionallowsentryordersforstrategywithStrategyIndexnumber.

Usage

pmms_strategy_allow_entries(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_allow_entries(0)

547

pmms_strategy_allow_exitsThisfunctionallowsexitordersforstrategywithStrategyIndexnumber.

Usage

pmms_strategy_allow_exits(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_allow_exits(0)

548

pmms_strategy_allow_exit_from_longThesameaspmms_strategy_allow_exits,butappliedforexitsfromlongentriesonly.

549

pmms_strategy_allow_exit_from_shortThesameaspmms_strategy_allow_exits,butappliedforexitsfromshortentriesonly.

550

pmms_strategy_allow_long_entriesThesameaspmms_strategy_allow_entries,butappliedforlongentriesonly.

551

pmms_strategy_allow_short_entriesThesameaspmms_strategy_allow_entries,butappliedforshortentriesonly.

552

pmms_strategy_close_positionThisfunctionclosespositionofthestrategywithIndexnumberwithmarketorder(ordersgeneratedbythestrategywillbedeletedfromRawOrderscollection).

Usage

pmms_strategy_close_position(Index)

Parameters

Index-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_close_position(0)

553

pmms_strategy_currentcontractsReturnsanumericalvaluerepresentingnumberofcontractsofthepositionopenedbystrategywithStrategyIndexnumber.

Usage

pmms_strategy_currentcontracts(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Value1=pmms_strategy_currentcontracts(0);

554

pmms_strategy_deny_entriesThisfunctiondeniesentryordersforstrategywithStrategyIndexnumber(entryorderswillbedeletedfromRawOrderscollection).

Usage

pmms_strategy_deny_entries(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_deny_entries(0)

555

pmms_strategy_deny_exitsThisfunctiondeniesexitordersforstrategywithStrategyIndexnumber(exitorderswillbedeletedfromRawOrderscollection).

Usage

pmms_strategy_deny_exits(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_deny_exits(0)

556

pmms_strategy_deny_exit_from_longThesameaspmms_strategy_deny_exits,butappliedforexitsfromlongentriesonly.

557

pmms_strategy_deny_exit_from_shortThesameaspmms_strategy_deny_exits,butappliedforexitsformshortentriesonly.

558

pmms_strategy_deny_long_entriesThesameaspmms_strategy_deny_entries,butappliedforlongentriesonly.

559

pmms_strategy_deny_short_entriesThesameaspmms_strategy_deny_entries,butappliedforshortentriesonly.

560

pmms_strategy_entrypriceReturnsanumericalvaluerepresentinganaverageentrypriceofthepositionopenedbythestrategywithStrategyIndexnumber.

Usage

pmms_strategy_entryprice(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Value1=pmms_strategy_entryprice(0);

561

pmms_strategy_get_entry_contractsReturnsthenumberofcontractsoftheentryorderofthestrategywithStrategyIndexnumber.

Usage

pmms_strategy_get_entry_contracts(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_get_entry_contracts(0)

562

pmms_strategy_is_pausedReturnstrue/falsevalueindicatingifordersendingispausedforthestrategywithStrategyIndexnumber.

Usage

pmms_strategy_is_paused(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Condition1=pmms_strategy_is_paused(0);

563

pmms_strategy_marketpositionReturnsanumericalvaluerepresentingmarketpositionofthestrategywithStrategyIndexnumber.

Usage

pmms_strategy_marketposition(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Value1=pmms_strategy_marketposition(0);

564

pmms_strategy_maxiddrawdownReturnsanumericalvaluerepresentingmaxdrawdownofthestrategywithStrategyIndexnumber.

Usage

pmms_strategy_maxiddrawdown(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Value1=pmms_strategy_maxiddrawdown(0);

565

pmms_strategy_netprofitReturnsanumericalvaluerepresentingnetprofitofthestrategywithStrategyIndexnumber.

Usage

pmms_strategy_netprofit(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Value1=pmms_strategy_netprofit(0);

566

pmms_strategy_openprofitReturnsanumericalvaluerepresentingunrealizedprofit/lossofthestrategywithStrategyIndexnumber.

Usage

pmms_strategy_openprofit(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Value1=pmms_strategy_openprofit(0);

567

pmms_strategy_pauseThisfunctiondeniesordersendingforthestrategywithStrategyIndexnumber(allordersofthestrategywillbedeletedfromRawOrdersCollection).

Usage

pmms_strategy_pause(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_pause(0);

568

pmms_strategy_resumeThisfunctionallowsordersendingforthestrategywithStrategyIndexnumber(allordersofthestrategywillbedeletedfromRawOrdersCollection).

Usage

pmms_strategy_resume(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_resume(0);

569

pmms_strategy_riskcapitalReturnsanumericalvaluerepresentingamountofmoneywithheldasariskcapitalfortheopenpositionofthestrategywithStrategyIndexnumber.

Usage

pmms_strategy_riskcapital(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Value1=pmms_strategy_riskcapital(0);

570

pmms_strategy_set_entry_contractsThisfunctionsetsthenumberofcontractsforentryordersofthestrategywithStrategyIndexnumber(sizecalculatedbythestrategyitselfwillbeignored).Tousetheordersizecalculatedbythestrategyitselfsetcontractsparameterto-1.

Usage

pmms_strategy_set_entry_contracts(StrategyIndex,Contracts)

Parameters

StrategyIndex-numericvariable.

Contracts-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_set_entry_contracts(0,5)

571

pmms_strategy_set_statusThisfunctionsetsatext(string)statusforthestrategywithStrategyIndexnumberoftheportfolio(statusisindicatedintheCustomTextcolumnofPortfolioReal-TimeWindow).

Usage

pmms_strategy_set_status(StrategyIndex,Status)

Parameters

StrategyIndex-numericvariable.

Status-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_set_status("Long");

572

pmms_strategy_symbolReturnsastringvaluerepresentingthenameofinstrumenttowhichthesignalofthestrategywithStrategyIndexnumberisapplied.

Usage

pmms_strategy_symbol(StrategyIndex)

Parameters

StrategyIndex-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmms_strategy_symbol(0);

573

pmm_get_global_named_numReturnsanumericalvalue,indicatingtheglobalnumericalvaluewithVariableNamename.

Usage

pmm_get_global_named_num(VariableName)

Parameters

VariableName-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Value1=pmm_get_global_named_num("GlobalVar");

574

pmm_get_global_named_strReturnstheglobalstringvaluewithVariableNamename.

Usage

pmm_get_global_named_str(VariableName)

Parameters

VariableName-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmm_get_global_named_str("GlobalStr");

575

pmm_get_my_named_numReturnsanumericalvalue,indicatingthevalueofVariableNameofthecurrentstrategy.

Usage

pmm_get_my_named_num(VariableName)

Parameters

VariableName-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Value1=pmm_get_my_named_num("CustomVar");

576

pmm_get_my_named_strReturnsastringvalue,indicatingthevalueofVariableNameofthecurrentstrategy.

Usage

pmm_get_my_named_str(VariableName)

Parameters

VariableName-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmm_get_my_named_str("CustomStr");

577

pmm_set_global_named_numThisfunctionsetstheglobalnumericvaluewithVariableNamename.

Usage

pmm_set_global_named_num(VariableName,VariableValue)

Parameters

VariableName-stringvariable.

VariableValue-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmm_set_global_named_num("GlobalVar",3);

578

pmm_set_global_named_strThisfunctionsetstheglobalstringvaluewithVariableNamename.

Usage

pmm_set_global_named_str(VariableName,VariableValue)

Parameters

VariableName-stringvariable.

VariableValue-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

ifmarketposition>0thenpmm_set_global_named_str("GlobalStr",symbolname+"isLong");

579

pmm_set_my_named_numThisfunctionsetsthevalueofVariableNameofthecurrentstrategy.

Usage

pmm_set_my_named_num(VariableName,VariableValue)

Parameters

VariableName-stringvariable.

VariableValue-numericvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

pmm_set_my_named_num("MarketPosition",marketposition);

580

pmm_set_my_named_strThisfunctionsetsthestringvalueofVariableNameofthecurrentstrategy.

Usage

pmm_set_my_named_str(VariableName,VariableValue)

Parameters

VariableName-stringvariable.

VariableValue-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

ifmarketposition>0thenpmm_set_my_named_str("Position","Long");

581

pmm_set_my_statusThisfunctionsetsatext(string)statusforthecurrentstrategyoftheportfolio(statusisindicatedintheCustomTextcolumnofPortfolioReal-TimeWindow).

Usage

pmm_set_my_status(Status)

Parameters

Status-stringvariable.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

ifmarketposition<0thenpmm_set_my_status("Short");

582

Portfolio_GrossLossReturnsanegativenumericalvalue,indicatingthetotalcurrencyvalueofallcompletedlosingtradesforaportfolio.

Usage

Portfolio_GrossLoss

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_GrossLosswillreturnavalueof-50iftherewereatotaloffourlosingtrades,at10,5,20,and15

Portfolio_GrossLosswillreturnavalueof0ifnolosingtradeswerecompletedduringtheentiretradingperiod

583

Portfolio_GrossProfitReturnsanumericalvalue,indicatingthetotalcurrencyvalueofallcompletedwinningtradesforaportfolio.

Usage

Portfolio_GrossProfit

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_GrossProfitwillreturnavalueof50iftherewereatotaloffourwinningtrades,at10,5,20,and15

Portfolio_GrossProfitwillreturnavalueof0ifnowinningtradeswerecompletedduringtheentiretradingperiod

584

Portfolio_InvestedCapitalReturnsabsolutevalueindicatingtheamountofcashassetsinvestedinportfoliosecuritiesonthemomentofstrategycalculation.

Usage

Portfolio_InvestedCapital

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_InvestedCapitalwillreturnavalueof100000iftheamountofcashassetsinvestedinportfoliosecuritiesonthemomentofstrategycalculationis100000unitsoftheselectedcurrency(e.g.therearethreeopenpositions:50000long,20000longand30000short).

585

Portfolio_MaxIDDrawdownReturnsanegativenumericalvalue,indicatingthelargestdeclineinequityfortheentireportfolioduringthetradingperiod.

Usage

Portfolio_MaxIDDrawdown

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_MaxIDDrawdownwillreturnavalueof-500ifthelargestdeclineinequityduringtheentiretradingperiodwas¤500

586

Portfolio_NetProfitReturnsanumericalvalue,indicatingthetotalcurrencyvalueofallcompletedtradesforaportfolio.

Usage

Portfolio_NetProfit

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_NetProfitwillreturnavalueof20iftherewerewinningtradesat25and10,andlosingtradesat5and10

Portfolio_NetProfitwillreturnavalueof-15iftherewerewinningtradesat10and5,andlosingtradesat20and10

Portfolio_NetProfitwillreturnavalueof0notradeswerecompletedduringtheentiretradingperiod

587

Portfolio_NumLossTradesReturnsanumericalvalue,indicatingthenumberofallcompletedlosingtradesforaportfolio.

Usage

Portfolio_NumLossTrades

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Portfolio_NumLossTradeswillreturnavalueof5iftherewereatotaloffivecompletedlosingtrades

Portfolio_NumLossTradeswillreturnavalueof0ifnolosingtradeswerecompletedduringtheentiretradingperiod

588

Portfolio_NumWinTradesReturnsanumericalvalue,indicatingthenumberofallcompletedwinningtradesforaportfolio.

Usage

Portfolio_NumWinTrades

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Portfolio_NumWinTradeswillreturnavalueof5iftherewereatotaloffivecompletedwinningtrades

Portfolio_NumWinTradeswillreturnavalueof0ifnowinningtradeswerecompletedduringtheentiretradingperiod

589

Portfolio_PercentProfitReturnsanumericalvalue,indicatingthepercentageofwinningtradesinalltradescompletedforaportfolio.

Usage

Portfolio_PercentProfit

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Portfolio_PercentProfitwillreturnavalueof70ifsevenoutofthetotalof10completedtradeswerewinningtrades

590

Portfolio_StrategyDrawdownReturnsanegativenumericalvalue,indicatingthecurrentdeclineinequityfortheentireportfoliofromthepeakvaluefortheentiretradingperiod.

Usage

Portfolio_StrategyDrawdown

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_StrategyDrawdownwillreturnavalueof-100ifthecurrentdeclineinequityfromthepeakvalueis¤100

591

Portfolio_TotalTradesReturnsanumericalvalue,indicatingthetotalnumberofallcompletedtradesforaportfolio.

Usage

Portfolio_TotalTrades

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Portfolio_TotalTradeswillreturnavalueof5iftherewereatotaloffivecompletedtrades

Portfolio_TotalTradeswillreturnavalueof0ifnotradeswerecompletedduringtheentiretradingperiod

592

Portfolio_CalcMaxPotentialLossForEntryCalculatesandreturnsmaximumpotentialloss(notincludingmargin,commisionorslippage)ifuserenteredthepositionwiththenumberofContractsandPriceofentry.

Usage

Portfolio_CalcMaxPotentialLossForEntry(Side<,Contracts<,Price>>);

Parametersinsidetheangledbracketsareoptional

Parameters

Sideisanumericalexpressionspecifyingtheentrytype(e.g.1Longentryor-1Shortentry).

Contractsisanoptionalparameterspecifyingthenumberofcontracts.IftheContractsparameterisnotspecified,thenthenumberofcontractsindicatedintheFormatSettingsdialogwindowunderthePropertiestabisusedbydefault.

Priceisanoptionalparameterspecifyingthepricevalue.IfthePriceparameterisnotspecified,thentheClosepricevalueofthecurrentbarwillbeusedbydefault.ThisparametercanberoundeddownifenteredaShortpositionorroundedupifenteredaLongposition.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_CalcMaxPotentialLossForEntry(0,25,High)willreturnavalueof0,sincetheparameterSide=0

593

Portfolio_CalcMaxPotentialLossForEntry(1,100,Close)willreturnthemaximumpotentialloss(notincludingmargin,commisionorslippage)ifuserenteredaLongpositionfor100contractsattheCloseprice.

Portfolio_CalcMaxPotentialLossForEntry(-1,5,Open)willreturnthemaximumpotentialloss(notincludingmargin,commisionorslippage)ifuserenteredaShortpositionfor5contractsatOpenprice.

Portfolio_CalcMaxPotentialLossForEntry(1)willreturnthemaximumpotentialloss(notincludingmargin,commisionorslippage)iftheuserenteredaLongpositionforanumberofcontractsindicatedintheFormatSettingsdialogwindowunderthePropertiestabatCloseprice.

594

Portfolio_CurrentEntries

Returnsanumericalvalue,indicatingthecombinednumberofentriescurrentlyopenwithinaportfolio.

Usage

Portfolio_CurrentEntries

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Assignavalue,indicatingthecombinednumberofentriescurrentlyopenwithinaportfolio,toValue1variable:

Value1=Portfolio_CurrentEntries;

595

Portfolio_MaxOpenPositionPotentialLossReturnsavalueindicatingthecombinedpotentialloss(notincludingmargin,commisionorslippage)forthetradedsymbol'sopenpositionwithintheportfolio.

Usage

SetStopPosition;

SetStopLoss(Portfolio_MaxOpenPositionPotentialLoss);

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

value1=Portfolio_MaxOpenPositionPotentialLoss;

ifvalue1<>0thenbegin

SetStopPosition;

SetStopLoss(value1);

end;

Portfolio_MaxOpenPositionPotentialLosswillreturnavalueof0iftherearecurrentlynoopenpositionswithinaportfolio.

Portfolio_MaxOpenPositionPotentialLosswillreturnavalueof100ifthecombinedpotentiallossforallopenpositionswithinaportfoliois¤100sincethepositionswereentered.

596

Portfolio_OpenPositionProfit

Returnsanumericalvalue,indicatingthecurrentcombinedprofitorlossforallopenpositionswithinaportfolio.

Usage

Portfolio_OpenPositionProfit

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_OpenPositionProfitwillreturnavalueof0iftherearecurrentlynoopenpositionswithinaportfolio

Portfolio_OpenPositionProfitwillreturnavalueof100ifthecombinedvalueofallopenpositionswithinaportfoliohasincreasedby¤100sincethepositionswereentered

Portfolio_OpenPositionProfitwillreturnavalueof-50ifthecombinedvalueofallopenpositionswithinaportfoliohasdecreasedby¤50sincethepositionswereentered

597

Portfolio_SetMaxPotentialLossPerContractRedefinesthevaluesfortheindicatedsymbol.Thevaluesinthe¤boxiftheAbsoluteMaxPotentialLossoptionisselectedorthevaluesinthe%boxiftheMaxPotentialLossisselected.

ThenewlysetvalueisvalidduringthestrategycalculationoruntilthePortfolio_SetMaxPotentialLossPerContractisrequestedagainassigninganewvalue.

Usage

Portfolio_SetMaxPotentialLossPerContract(NewValue);

Parameters

NewValueisanumericalvaluethatcanbe:

anabsolutevalueintherange[-100,-0.001];definespercentageofthemaximumpotentiallosspercontract.(MaxPotentialLoss:%)avalueintherange[0.001,1e+29];definesthemaximumpotentiallosspercontractintheselectedcurrency.(AbsoluteMaxPotentialLoss:¤)equal0;inthiscasethevalueenteredintheFormatSettingsdialogwindowunderthePortfolioSettingstabisused.

Portfolio_SetMaxPotentialLossPerContractreturns:

Trueifthevalueisinoneoftherangesindicatedabove.Redefiningisconsideredtobesuccesfull.Falseiftheifthevalueisoutoftherangesindicatedabove.RedefiningisconsideredunsuccessfulandtheMaxPotentialLossvalueisunchanged.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

ThevalueisreturnedinthecurrencyspecifiedinPortfolioTrader:Portfolio

598

Settings->BaseCurrency.

Example

If"MSFT"=SymbolNamethenPortfolio_SetMaxPotentialLossPerContract(-10);thenewvalueof-10isassignedforthesymbol"MSFT"onlyifsuchsymbolisexistintheportfolio.

Portfolio_SetMaxPotentialLossPerContract(-5);redefinesthepercentagevalueofthemaximumpotentiallosspercontractfor5%.

Portfolio_SetMaxPotentialLossPerContract(200);redefinesthemaximumpotentiallosspercontractfor¤200.

599

PortfolioEntriesPriorityAssignsaprioritytoeachentryorderwithinaportfolio.

Ifexecutionofallentriesgeneratedforaportfoliowouldcausethecapitallimitstobeexceeded,theentrieswiththehighestprioritywillreceivepreference,whiletheentrieswiththelowestprioritywillnotbeexecuted.

IfPortfolioEntriesPriorityisnotspecified,theentrieswillbeexecutedaccordingtotheorderthesymbolsarelistedinthesymbolgridofthePortfolioTrader.

Usage

PortfolioEntriesPriority=Priority

Where:Priority-anumericalexpressionspecifyingtheentryorderexecutionpriority;agreatervalueindicatesahigherpriority

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Assignhigherexecutionprioritytoentryordersforsymbolswithlowershareprices:

PortfolioEntriesPriority=(-Close);

600

Portfolio_GetMarginPerContractReturns:

anumericalvalueindicatedinthe%ofcontractcostboxmultipliedby-1,iftheMarginvalueoptionisselected;or:thesamevalueasareservedwordMarginiftheAbsoluteMarginValueoptionisselected.

Usage

Portfolio_GetMarginPerContract

Parameters

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

TheabsolutemarginvalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_GetMarginPerContractwillreturnavalueof0ifAbsoluteMarginValueoptionisselectedandthemargindoesnotexistintheQuoteManagersymbolsettings.Notallofthesecuritiescanbeboughtonmargin.Themarginvaluecanbereturnedforfuturesoroptions.

Portfolio_GetMarginPerContractwillreturnavalueof25ifAbsoluteMarginValueoptionisselectedandthemarginboxintheEditSymboldialogwindowunderFuturetabinQuoteManagercontainsthevalueof25.

601

Portfolio_GetMarginPerContractwillreturnavalueof-10iftheMarginValueoptionisselectedandthe%ofcontractcostboxcontainsthevalueof10.

602

Portfolio_GetMaxPotentialLossPerContractReturns:

anumericalvalueindicatedinthe%boxmultipliedby-1,iftheMaxPotentialLossoptionisselectedintheFormatSettingsdialogwindowunderthePortfolioSettingstab;or:anumericalvalueindicatedintheAbsoluteMaxPotentialLossoptionboxintheFormatSettingsdialogwindowunderthePortfolioSettingstab.

Usage

Portfolio_GetMaxPotentialLossPerContract

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

TheabsolutemaxpotentiallossvalueisreturnedinthecurrencyspecifiedinPortfolioTrader:PortfolioSettings->BaseCurrency.

Example

Portfolio_GetMaxPotentialLossPerContractwillreturn-5iftheMaxPotentialLossoptionisselectedand%boxvalueis5underthePortfolioSettingstabintheFormatSettingsdialogwindow.

Portfolio_GetMaxPotentialLossPerContractwillreturn0.001iftheAbsoluteMaxPotentialLossoptionisselectedand¤boxvalueis0.001underthePortfolioSettingstabintheFormatSettingsdialogwindow.

603

Portfolio_MaxRiskEquityPerPosPercentReturnstheMax%ofEquityatRiskperPositionnumericalvaluesetbytheuserinthePortfolioSettingstabofthePortfolioTraderFormatSettingswindow.

Usage

Portfolio_MaxRiskEquityPerPosPercent

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Portfolio_MaxRiskEquityPerPosPercentwillreturntheMax%ofEquityatRiskperPositionnumericalvaluesetbytheuser

604

Portfolio_TotalMaxRiskEquityPercentReturnstheequityExposure%numericalvaluesetbytheuserinthePortfolioSettingstabofthePortfolioTraderFormatSettingswindow.

Usage

Portfolio_TotalMaxRiskEquityPercent

Notes

ThisfunctioncanonlybeusedinsignalsintendedtobeusedwiththePortfolioTrader.

Example

Portfolio_TotalMaxRiskEquityPercentwillreturntheequityExposure%numericalvaluesetbytheuser.

605

AskSizeReturnsanumericalvalueindicatingthecurrentbestAskvolumeforthesymbolthatthestudyisappliedto.

Usage

AskSize

Notes

QuoteFieldscannotbereferencedhistorically.

Example

AskSizewillreturnthecurrentbestAskvolume

606

BidSizeReturnsanumericalvalueindicatingthecurrentbestBidvolumeforthesymbolthatthestudyisappliedto.

Usage

BidSize

Notes

QuoteFieldscannotbereferencedhistorically.

Example

BidSizewillreturnthecurrentbestBidvolume

607

CurrentOpenIntReturnsanumericalvalueindicatingthelastknownopeninterestforthesymbolthatthestudyisappliedto.

Usage

CurrentOpenInt

Notes

QuoteFieldscannotbereferencedhistorically.

Example

CurrentOpenIntwillreturnthelastknownopeninterest

608

DailyCloseReturnsanumericalvalueindicatingthemostrecentCloseprice.

Usage

DailyClose

Notes

QuoteFieldscannotbereferencedhistorically.

Example

DailyClosewillreturnthemostrecentCloseprice

609

DailyHighReturnsanumericalvalueindicatingtheHighpriceforthecurrenttradingsession.

Usage

DailyHigh

Notes

QuoteFieldscannotbereferencedhistorically.

Example

DailyHighwillreturntheHighpriceforthecurrenttradingsession

610

DailyLowReturnsanumericalvalueindicatingtheLowpriceforthecurrenttradingsession.

Usage

DailyLow

Notes

QuoteFieldscannotbereferencedhistorically.

Example

DailyLowwillreturntheLowpriceforthecurrenttradingsession

611

DailyOpenReturnsanumericalvalueindicatingtheopeningpriceforthecurrenttradingsession.

Usage

DailyOpen

Notes

QuoteFieldscannotbereferencedhistorically.

Example

DailyOpenwillreturntheOpenpriceforthecurrenttradingsession

612

DailyVolumeReturnsanumericalvalueindicatingthecurrenttotaltradevolumeforthetradingsession.

Usage

DailyVolume

Notes

QuoteFieldscannotbereferencedhistorically.

Example

DailyVolumewillreturnthecurrenttotaltradevolume

613

DescriptionReturnsastringexpressioncontainingthedescriptionforthesymbolthatthestudyisappliedto;ifnodescriptionisavailable,ablank("")stringexpressionwillbereturned.

Usage

Description

Example

Descriptionwillreturn"GOOGLEINC"forGoogle

614

ExchListedReturnsastringexpressioncontainingtheexchangenameforthesymbolthatthestudyisappliedto.

Usage

ExchListed

Example

ExchListedwillreturn"NASD"forGoogle

ExchListedwillreturn"CME"forE-miniS&P;500

615

InsideAskReturnsanumericalvalueindicatingthecurrentbestAskforthesymbolthatthestudyisappliedto.

Usage

InsideAsk

Notes

QuoteFieldscannotbereferencedhistorically.

Example

InsideAskwillreturnthecurrentbestAsk

616

InsideBidReturnsanumericalvalueindicatingthecurrentbestBidforthesymbolthatthestudyisappliedto.

Usage

InsideBid

Notes

QuoteFieldscannotbereferencedhistorically.

Example

InsideBidwillreturnthecurrentbestBid

617

LastReturnsanumericalvalueindicatingthepriceofthelastcompletedtrade.

Usage

Last

Notes

QuoteFieldscannotbereferencedhistorically.

Example

Lastwillreturnthepriceofthelasttrade

618

PrevCloseReturnsanumericalvalueindicatingtheclosingpriceoftheprevioustradingsession.

Usage

PrevClose

Notes

QuoteFieldscannotbereferencedhistorically.

Example

PrevClosewillreturntheCloseoftheprevioustradingsession

619

q_AskRetainedforbackwardcompatibility;replacedwithInsideAsk.

620

q_asksizeRetainedforbackwardcompatibility;replacedwithAskSize.

621

q_BidRetainedforbackwardcompatibility;replacedwithInsideBid.

622

q_bidsizeRetainedforbackwardcompatibility;replacedwithBidSize.

623

q_BigPointValueRetainedforbackwardcompatibility;replacedwithBigPointValue.

624

q_DateRetainedforbackwardcompatibility;replacedwithTradedDate.

625

q_ExchangeListedRetainedforbackwardcompatibility;replacedwithExchListed.

626

q_LastRetainedforbackwardcompatibility;replacedwithLast.

627

q_OpenInterestRetainedforbackwardcompatibility;replacedwithCurrentOpenInt.

628

q_PreviousCloseRetainedforbackwardcompatibility;replacedwithPrevClose.

629

q_TimeRetainedforbackwardcompatibility;replacedwithTradeTime.

630

q_Time_DtReturnsadouble-precisiondecimalDateTimevalueindicatingcurrenttimefromthestatusline.

Usage

q_Time_Dt

Example

q_Time_Dtwillreturnavalueof39448.25000000for6:00AMonJanuary1st,2008

631

q_Time_sSameasq_Time.

TimeisindicatedinHHmmssformat.

632

q_TotalVolumeRetainedforbackwardcompatibility;replacedwithDailyVolume.

633

q_tradevolumeRetainedforbackwardcompatibility;sameasTradeVolume.

634

RTSymbolSameastheRTSymbolName.

635

RTSymbolNameReturnsastringexpressioncontainingthenameofthereal-timesymbolthatthestudyisappliedtoincasethemergingoptionisenabled.IfthemergingoptionisdisabledreturnsthesamevalueastheNameproperty.Incaseofacustomfuturesinstrumentthenameofthelastcontractisreturned.

SeealsoGetRTSymbolName

Usage

RTSymbolName

Example

RTSymbolNamewillreturn"GOOG"forGoogleifthemergingoptionisenabledandGoogleisconfiguredasthereal-timeinstrument.

636

SymbolSameastheSymbolName.

637

SymbolNameReturnsastringexpressioncontainingthenameofthesymbolthatthestudyisappliedto.

SeealsoGetSymbolName

Usage

SymbolName

Example

SymbolNamewillreturn"GOOG"forGoogle

638

TradeDate

Returnsanumericalvalueindicatingthedateofthemostrecentpricefieldupdateforthesymbol.ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

TradeDate

Notes

QuoteFieldscannotbereferencedhistorically.

Example

TradeDatewillreturnavalueof1071030forOctober30th,2007

TradeDatewillreturnavalueof990402forApril2th,1999

639

TradeTime

Returnsanumericalvalueindicatingthetimeofthemostrecentpricefieldupdateforthesymbol.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

TradeTime

Notes

QuoteFieldscannotbereferencedhistorically.

Example

TradeTimewillreturnavalueof1015for10:15AM

TradeTimewillreturnavalueof1545for3:45PM

640

TradeVolumeReturnsanumericalvalueindicatingthevolumeofLastPrice.InformationistakenfromtheStatusLine.

Usage

TradeVolume

Notes

QuoteFieldscannotbereferencedhistorically.

Example

TradeVolumewillreturnthevalueof5ifLastSizewas5.

641

AutoSessionReturns0andisusedasanargumentinsessioninformationfunctions.

642

RegularSessionReturns1andisusedasanargumentinsessioninformationfunctions.

643

Sess1EndTimeThiswordisretainedforbackwardcompatibility.

644

Sess1FirstBarTimeReturnstheFirstbar'stimeforthefirstsessionofthetradingdayin24-hourformat.PleasenotethattheTimeZonesettingaffectsthevaluereturned.

Example

Sess1FirstBarTimereturns0945whenappliedtoMSFTdatawitha15-minuteinterval

Sess1FirstBarTimereturns0835whenappliedtoE-miniS&P500;Datawitha5-minuteinterval

645

Sess1StartTimeThiswordisretainedforbackwardcompatibility.

646

Sess2EndTimeThiswordisretainedforbackwardcompatibility.

647

Sess2FirstBarTimeReturnstheFirstbar stimeforthesecondsessionofthetradingdayin24-hourformat.PleasenotethattheTimeZonesettingaffectsthevaluereturned.

Example

Sess2FirstBarTimereturns1725whenappliedtoUSTreasuryBondDatawitha5-minuteinterval.

648

Sess2StartTimeThiswordisretainedforbackwardcompatibility.

649

SessionCountReturnsthenumberofsessionsforthetradingweek.

Usage

SessionCount(SessionType);

Where:SessionType-anumericalexpression:0=AutoDetect,1=RegularSession*

*CustomSessionsparameterswillbeusedifselectedinQuoteManager.

Example

Inthisexample,wehaveassignedtoValue1thetotalnumberofsessionsfortheweekinthecurrentbar.

Value1=SessionCount(0);

Inthisexample,wehaveassignedtoValue1thetotalnumberofregularsessionsfortheweekinthecurrentbar.

Value1=SessionCount(1);

650

SessionCountMSReturnsthenumberofmergedsessionsforthetradingweek.Mergedsessionsaresessionsbeginningattheearlieststarttimeforallsymbolsandendingatthelatestendtimeforallsymbolseachtradingday.

Example

Inthisexample,wehaveassignedtoValue1thetotalnumberofmergedsessionsfortheweekinthecurrentchart:

Value1=SessionCountMS

651

SessionEndDayReturnsanumericalvalueindicatingthedayoftheweekthatthespecifiedsessionends,where0=Sunday,1=Monday,etc.

Usage

SessionEndDay(SessionType,SessionNum)

Where:SessionType-anumericalexpression:0=AutoDetect,1=RegularSession*SessionNum-anumericalexpressionspecifyingtheSessionNumber

*CustomSessionsparameterswillbeusedifselectedinQuoteManager.

Example

Assignavalue,indicatingthedayoftheweekthatthe4thregularsessionends,toValue1variable:

Value1=SessionEndDay(1,4)

652

SessionEndDayMSReturnsanumericalvalueindicatingthedayoftheweekthespecifiedmergedsessioninamulti-dataserieschartends,where0=Sunday,1=Monday,etc.

Mergedsessionextendsfromtheearlieststarttimetothelatestendtimeofallsessionsmerged.

Usage

SessionEndDayMS(SessionNum)

Where:SessionNum-anumericalexpressionspecifyingtheSessionNumber

Example

Assignavalue,indicatingthedayoftheweekthatthe4thmergedsessionends,toValue1variable:

Value1=SessionEndDayMS(4);

653

SessionEndTime

Returnsanumericalvalue,indicatingthetimeofthedaythatthespecifiedsessionends.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

SessionEndTime(SessionType,SessionNum)

Where:SessionType-anumericalexpression:0=AutoDetect,1=RegularSession*SessionNum-anumericalexpressionspecifyingtheSessionNumber

*CustomSessionsparameterswillbeusedifselectedinQuoteManager.

Example

Assignavalue,indicatingthetimeofthedaythatthe4thregularsessionends,toValue1variable:

Value1=SessionEndTime(1,4);

654

SessionEndTimeMS

Returnsanumericalvalue,indicatingthetimeofthedaythatthespecifiedmergedsessioninamulti-dataserieschartends.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Mergedsessionextendsfromtheearlieststarttimetothelatestendtimeofallsessionsmerged.

Usage

SessionEndTimeMS(SessionNum)

Where:SessionNum-anumericalexpressionspecifyingtheSessionNumber

Example

Assignavalue,indicatingthetimeofthedaythatthe4thmergedsessionends,toValue1variable:

Value1=SessionEnd(4);

655

SessionStartDayReturnsanumericalvalueindicatingthedayoftheweekthatthespecifiedsessionstarts,where0=Sunday,1=Monday,etc.

Usage

SessionStartDay(SessionType,SessionNum)

Where:SessionType-anumericalexpression:0=AutoDetect,1=RegularSession*SessionNum-anumericalexpressionspecifyingtheSessionNumber

*CustomSessionsparameterswillbeusedifselectedinQuoteManager.

Example

Assignavalue,indicatingthedayoftheweekthatthe4thregularsessionstarts,toValue1variable:

Value1=SessionStartDay(1,4);

656

SessionStartDayMSReturnsanumericalvalueindicatingthedayoftheweekthatthespecifiedmergedsessioninamulti-dataserieschartstarts,where0=Sunday,1=Monday,etc.

Mergedsessionextendsfromtheearlieststarttimetothelatestendtimeofallsessionsmerged.

Usage

SessionStartDayMS(SessionNum)

Where:SessionNum-anumericalexpressionspecifyingtheSessionNumber

Example

Assignavalue,indicatingthedayoftheweekthatthe4thmergedsessionstarts,toValue1variable:

Value1=SessionStartDayMS(4);

657

SessionStartTime

Returnsanumericalvalue,indicatingthetimeofthedaythatthespecifiedsessionstarts.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

SessionStartTime(SessionType,SessionNum)

Where:SessionType-anumericalexpression:0=AutoDetect,1=RegularSession*SessionNum-anumericalexpressionspecifyingtheSessionNumber

*CustomSessionsparameterswillbeusedifselectedinQuoteManager.

Example

Assignavalue,indicatingthetimeofthedaythatthe4thregularsessionstarts,toValue1variable:

Value1=SessionStartTime(1,4);

658

SessionStartTimeMS

Returnsanumericalvalue,indicatingthetimeofthedaythatthespecifiedmergedsessioninamulti-dataserieschartstarts.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Mergedsessionextendsfromtheearlieststarttimetothelatestendtimeofallsessionsmerged.

Usage

SessionStartTimeMS(SessionNum)

Where:SessionNum-anumericalexpressionspecifyingtheSessionNumber

Example

Assignavalue,indicatingthetimeofdaythatthe4thmergedsessionstarts,toValue1variable:

Value1=SessionStartTimeMS(4);

659

AASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

660

AnASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

661

AtASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

662

BasedASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

663

ByASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

664

DoesASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

665

FromAskipword;usedinstrategyexitstatementsincombinationwithEntrywordthattiesanexittotheparticularentrythatwasassignedtheEntryLabelname.

Anexitcanonlybetiedtoanentrywithinthesamesignal;formoreinformation,seeBuyorSellShort.

SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Usage

FromEntry("EntryLabel")

Where:EntryLabel-thenamethatwasassignedtotheentrythattheexitistobetiedtoFrom-askipwordandcanbeomitted

Example

Completelyexitfromthelongpositionestablishedbytheentrylabeled"OriginalEntry",atMarketpriceonopenofnextbar:

SellFromEntry("OriginalEntry")NextBaratOpen;

666

IsASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

667

OfASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

668

OnASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

669

PlaceASkipWordretainedforbackwardcompatibility.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

670

ThanASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

671

TheASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

672

WasASkipWord.SkipWordsservesolelytoimprovethereadabilityofPowerLanguagecodeandareskipped(ignored)duringthecompilationandexecution.

TheuseofSkipWordsisoptional;theycanbeinsertedanywherewithinthePLcodeandwillappearinredinPowerLanguageEditor.

Example

TheSkipWordsintheexamplebelowarecoloredinred:

IfanOpenis<thanCloseof4BarsAgowasThenBuyThisBaronClose;IfPlot1doesCrossAbovea1350ThenSellFromEntry("MyEntry")NextBarattheMarket;

673

All

Usedinstrategyexitstatementsinplaceofanumericalexpression,precedingthewordsSharesorContracts,todenoteallofthesharesorallofthecontractsheldwithoutspecifyingtheactualnumberofsharesorcontracts.

Usage

AllContracts

Example

Sellallofthesharesheldatmarketpriceonopenofnextbar:

SellAllSharesNextBarAtMarket;

674

BuyEntersalongpositionasspecifiedbytheparameters.

TheentrypointisvisuallyindicatedonachartbyanArrowandaTick.TheArrowidentifiesthetimeandtheTickidentifiesthepricevalueoftheentrypoint.Labels,displayingtheentrynameandthenumberofcontractsorsharestraded,aredisplayedbelowtheBuyArrow.

Anorderisexecutedatthepointspecifiedbytheparameters;iftheorderisnotfilledwithinthespecifiedbar,theorderiscancelled.

WhenaBuyorderisfilled,anyopenshortpositionswillalsobeclosed.

Usage

Buy[("EntryLabel")][TradeSize]EntryType;

Parametersinsidethesquarebracketsareoptional

ParametersEntryLabel-anoptionalparameter;assignsanamethatwillbedisplayedinthenamelabelbelowtheentry,andcanbeusedtoidentifytheparticularentryandtotieanexittoit.

Anexitcanonlybetiedtoanentrywithinthesamesignal;formoreinformation,seeSell.

IfEntryLabelisnotspecified,thename"Buy"willbeusedforthefirstentry,"Buy#2"forthesecondentry,"Buy#3"forthethirdentry,etc.

TradeSize-anoptionalparameter;anumericalexpression,specifyingthenumberofcontractsorsharestobuy;theexpressionmustbefollowedbyoneofthefollowingtransposablewords:Share,Shares,ContractorContracts.

IfTradeSizevalueequals0orisnegative,alongpositionwillnotbeenteredbutanyopenshortpositionswillbeclosed.

IfTradeSizeisnotspecified,thetradesizevaluesetbytheuserintheProperties

675

taboftheStrategyPropertieswindowwillbeused.

EntryType-arequiredparameter;specifiesthetimingandpriceofentry.

TherearefourkindsofEntryType:

ThisBar[On]Close

Where:-Onisaskipwordandcanbeomitted

ABuyArrowwillbeplacedatthecurrentbar'sClosetick.

NextBar[At]OpenorNextBar[At]Market

Where:-words"Market"and"Open"aretransposable-Atisaskipwordandcanbeomitted

ABuyArrowwillbeplacedatthenextbar'sOpentick.

NextBar[At]PriceLimit

Where:-Priceisanumericalexpression,specifyingtheLimitPrice-Atisaskipwordandcanbeomitted

ABuyArrowwillbeplacedonthenextbaratthefirsttickwithapricevaluelessthanorequaltoPrice;iftherearenosuchtickswithinthenextbar,theorderwillbecancelled.

NextBar[At]PriceStop

Where:-Priceisanumericalexpression,specifyingtheStopPrice-Atisaskipwordandcanbeomitted

ABuyArrowwillbeplacedonthenextbaratthefirsttickwithapricevalueequaltoorgreaterthanthePrice;iftherearenosuchtickswithinthenextbar,theorderwillbecancelled.

Example

676

Buyauser-setnumberofsharesatMarketpriceoncloseofthisbar:

BuyThisBarOnClose;

Buy1shareatMarketpriceonopenofnextbarandlabeltheentry"Entry":

Buy("Entry")1ShareNextBarAtOpen;

Buy1contractatMarketpriceonopenofnextbarandlabeltheentry"Entry":

Buy("Entry")1ContractNextBarMarket;

Buy2shareswithinthenextbaronthefirsttickwithapriceof100orless:

Buy2SharesNextBarAt100Limit;

Buy10contractswithinthenextbaronthefirsttickwithapriceof50ormore:

Buy10ContractsNextBar50Stop;

677

BuyToCoverCompletelyorpartiallyexitsoneoralloftheshortentriesasspecifiedbytheparameters.

TheexitpointisvisuallyindicatedonachartbyanArrowandaTick.TheArrowidentifiesthetimeandtheTickidentifiesthepricevalueoftheexitpoint.Labels,displayingtheexitnameandthenumberofcontractsorsharestraded,aredisplayedbelowtheCoverArrow.

Anorderisexecutedatthepointspecifiedbytheparameters;iftheorderisnotfilledwithinthespecifiedbar,theorderiscancelled.

Usage

BuyToCover[("ExitLabel")][FromEntry("EntryLabel")][TradeSize[Total]]Exit

or:

BuyToCover[("ExitLabel")][FromEntry("EntryLabel")][TradeSize[Total]]Exit

Parametersinsidethesquarebracketsareoptional

Parameters

ExitLabel-anoptionalparameter;assignsanamethatwillbedisplayedinthenamelabelabovetheexit

IfExitLabelisnotspecified,thename"Cover"willbeusedforthefirstexit,"Cover#2"forthesecondexit,"Cover#3"forthethirdexit,etc.

EntryLabel-anoptionalparameter;tiestheexittotheparticularentrythatwasassignedtheEntryLabelname;thenamemustbeprecededbythewordEntry,thewordFromisaskipwordandcanbeomitted

Anexitcanonlybetiedtoanentrywithinthesamesignal.Formoreinformation,seeSellShort

IfEntryLabelisnotspecified,alloftheopenshortentrieswillbeclosed.

678

TradeSize-anoptionalparameter;anumericalexpression,specifyingthenumberofcontractsorsharestobuy;theexpressionmustbefollowedbyoneofthefollowingtransposablewords:Share,Shares,ContractorContracts.

Bydefault,thenumberofcontractsorsharesspecifiedbytheTradeSizeparameterwillbecoveredfromeachoftheopenshortentries.

IfTradeSizeisfollowedbythewordTotal,onlythenumberofcontractsorsharesspecifiedbytheTradeSizeparameterwillbecovered,regardlessofthenumberofopenshortentries.Thecontractsorshareswillbecoveredinthesameordertheywereshorted:FirstIn,FirstOut.

IfTradeSizeisnotspecified,theentireshortpositionwillbeclosedout.

Exit-arequiredparameter;specifiesthetimingandpriceofexit.

TherearefourtypesofExit:

ThisBar[On]Close

Where:-Onisaskipwordandcanbeomitted

ACoverArrowwillbeplacedatthecurrentbar'sClosetick.

NextBar[At]OpenorNextBar[At]Market

Where:-words"Market"and"Open"aretransposable-Atisaskipwordandcanbeomitted

ACoverArrowwillbeplacedatthenextbar'sOpentick.

NextBar[At]PriceLimit

Where:-Priceisanumericalexpression,specifyingtheLimitPrice-Atisaskipwordandcanbeomitted

ACoverArrowwillbeplacedonthenextbaratthefirsttickwithapricevaluelessthanorequaltoPrice;iftherearenosuchtickswithinthenextbar,theorderwillbecancelled.

679

NextBar[At]PriceStop

Where:-Priceisanumericalexpression,specifyingtheStopPrice-Atisaskipwordandcanbeomitted

ACoverArrowwillbeplacedonthenextbaratthefirsttickwithapricevalueequaltoorgreaterthanthePrice;iftherearenosuchtickswithinthenextbar,theorderwillbecancelled.

Example

CompletelyexitallopenshortentriesatMarketpriceoncloseofthisbarandlabeltheexit"CompleteExit":

BuyToCover("CompleteExit")ThisBarOnClose;

Completelyexitfromtheshortpositionestablishedbytheentrylabeled"OriginalEntry",atMarketpriceonopenofnextbar:

BuyToCoverFromEntry("OriginalEntry")NextBarAtOpen;

Cover10sharesoftheshortpositionestablishedbytheentrylabeled"OriginalEntry",atMarketpriceonopenofnextbar:

BuyToCoverEntry("OriginalEntry")10SharesNextBarAtMarket;

Cover5contractsforeachoneoftheopenshortentriesatMarketpriceonopenofnextbar:

BuyToCover5ContractsNextBarMarket;

Coveratotalof1share,regardlessofthenumberofopenshortentries,withinthenextbaronthefirsttickwithapriceof100orless(thefirstshareshortedwillbecoveredifthepriceismet):

BuyToCover1ShareTotalNextBarAt100Limit;

Completelyexitallshortentrieswithinthenextbaronthefirsttickwithapriceof50ormore:

BuyToCoverNextBar50Stop;

680

681

ContractSameasContracts

682

ContractsUsedinstrategyentryorexitstatementsincombinationwithanumericalexpressiontospecifythenumberofcontractsorsharestotrade.

Usage

TradeSizeContracts

Where:TradeSize-anumericalexpression,specifyingthenumberofcontractsorshares

Example

Buy2contractsatMarketpriceonopenofnextbar:

Buy2ContractsNextBarAtMarket;

683

Cover

UsedincombinationwiththewordsBuyTo;sameasBuyToCover.

Usage

BuyToCover[("ExitLabel")][FromEntry("EntryLabel")][TradeSize[Total]]Exit;

684

EntryUsedinstrategyexitstatementstotieanexittotheparticularentrythatwasassignedtheEntryLabelname.

Anexitcanonlybetiedtoanentrywithinthesamesignal;formoreinformation,seeBuyorSellShort.

Usage

FromEntry("EntryLabel")

Where:EntryLabel-thenamethatwasassignedtotheentrythattheexitistobetiedtoFrom-askipwordandcanbeomitted

Example

Completelyexitfromthelongpositionestablishedbytheentrylabeled"OriginalEntry",atMarketpriceonopenofnextbar:

SellFromEntry("OriginalEntry")NextBarAtOpen;

685

Higher

Usedinstrategyentryorexitstatementstospecifyapricerangeforanentryoranexit;mustbeprecededbythewordOr.

Usage

AtPriceOrHigher

Where:Price-anumericalexpression,specifyingthebasePriceAt-askipwordandcanbeomitted

Notes

AtPriceOrHigherisanequivalentofaLimitwhenusedwithSellorSellShortstatements,andanequivalentofaStopwhenusedwithBuyorBuyToCoverstatements.

Example

Buywithinthenextbaronthefirsttickwithapriceof100ormore:

BuyNextBarAt100OrHigher;

Sellshortwithinthenextbaronthefirsttickwithapriceof50ormore:

SellShortNextBarAt50OrHigher;

686

LimitUsedinstrategyentryorexitstatementstospecifyaLimitpriceforanentryoranexit.

ALimitorderwillexecuteatthespecifiedpriceorbetter.AbetterpriceisalowerpriceforBuyandBuytocoverorders,andahigherpriceforSellandSellshortorders.

Usage

AtPriceLimit

Where:Price-anumericalexpression,specifyingtheLimitPriceAt-askipwordandcanbeomitted

Example

Buywithinthenextbaronthefirsttickwithapriceof100orless:

BuyNextBarAt100Limit;

Sellshortwithinthenextbaronthefirsttickwithapriceof50ormore:

SellShortNextBar50Limit;

687

LowerUsedinstrategyentryorexitstatementstospecifyapricerangeforanentryoranexit.

MustbeprecededbythewordOr.

Usage

AtPriceOrLower

Where:Price-anumericalexpression,specifyingthebasePriceAt-askipwordandcanbeomitted

Notes

AtPriceOrLowerisanequivalentofaLimitwhenusedwithBuyorBuyToCoverstatements,andanequivalentofaStopwhenusedwithSellorSellShortstatements.

Example

Buywithinthenextbaronthefirsttickwithapriceof100orless:

BuyNextBarAt100OrLower;

Sellshortwithinthenextbaronthefirsttickwithapriceof50orless:

SellShortNextBarAt50OrLower;

688

MarketUsedinstrategyentryorexitstatementstospecifyaMarketpriceforanentryoranexit.

AMarketBuyorderwillexecuteatthecurrentaskpriceandaMaretSellorderwillexecuteatthecurrentbidprice.

Usage

AtMarket

Where:Atisaskipwordandcanbeomitted

Example

Buyauser-setnumberofsharesatMarketpriceonopenofnextbar:

BuyNextBarAtMarket;

689

SellCompletelyorpartiallyexitsoneorallofthelongentriesasspecifiedbytheparameters.

TheexitpointisvisuallyindicatedonachartbyanArrowandaTick.TheArrowidentifiesthetimeandtheTickidentifiesthepricevalueoftheexitpoint.Labels,displayingtheexitnameandthenumberofcontractsorsharestraded,aredisplayedabovetheSellArrow.

Anorderisexecutedatthepointspecifiedbytheparameters;iftheorderisnotfilledwithinthespecifiedbar,theorderiscancelled.

UsageSell[("ExitLabel")][FromEntry("EntryLabel")][TradeSize[Total]]Exit

Parametersinsidethesquarebracketsareoptional

ParametersExitLabel-anoptionalparameter;assignsanamethatwillbedisplayedinthenamelabelabovetheexit

IfExitLabelisnotspecified,thename"Sell"willbeusedforthefirstexit,"Sell#2"forthesecondexit,"Sell#3"forthethirdexit,etc.

EntryLabel-anoptionalparameter;tiestheexittotheparticularentrythatwasassignedtheEntryLabelname;thenamemustbeprecededbytheword"Entry",theword"From"isaskipwordandcanbeomitted

Anexitcanonlybetiedtoanentrywithinthesamesignal.Formoreinformation,seeBuy

IfEntryLabelisnotspecified,alloftheopenlongentrieswillbeclosed.

TradeSize-anoptionalparameter;anumericalexpression,specifyingthenumberofcontractsorsharestosell;theexpressionmustbefollowedbyoneofthefollowingtransposablewords:Share,Shares,ContractorContracts.

Bydefault,thenumberofcontractsorsharesspecifiedbytheTradeSizeparameterwillbesoldfromeachoneoftheopenlongentries.

IfTradeSizeisfollowedbytheword"Total",onlythenumberofcontractsor

690

sharesspecifiedbytheTradeSizeparameterwillbesold,regardlessofthenumberofopenlongentries.Thecontractsorshareswillbesoldinthesameordertheywerebought:FirstIn,FirstOut.

IfTradeSizeisnotspecified,theentirelongpositionwillbeclosedout.

Exit-arequiredparameter;specifiesthetimingandpriceofexit.

TherearefourtypesofExit:

ThisBar[On]Close

Where:-Onisaskipwordandcanbeomitted

ASellArrowwillbeplacedatthecurrentbar'sClosetick.

NextBar[At]OpenorNextBar[At]Market

Where:-words"Market"and"Open"aretransposable-Atisaskipwordandcanbeomitted

ASellArrowwillbeplacedatthenextbar'sOpentick.

NextBar[At]PriceLimit

Where:-Priceisanumericalexpression,specifyingtheLimitPrice-Atisaskipwordandcanbeomitted

ASellArrowwillbeplacedonthenextbaratthefirsttickwithapricevaluegreaterthanorequaltoPrice;iftherearenosuchtickswithinthenextbar,theorderwillbecancelled.

NextBar[At]PriceStop

Where:-Priceisanumericalexpression,specifyingtheStopPrice-Atisaskipwordandcanbeomitted

ASellArrowwillbeplacedonthenextbaratthefirsttickwithapricevalueequaltoorlessthanthePrice;iftherearenosuchtickswithinthenextbar,theorderwillbecancelled.

691

Example

CompletelyexitallopenlongentriesatMarketpriceoncloseofthisbarandlabeltheexit"CompleteExit":

Sell("CompleteExit")ThisBarOnClose;

Completelyexitfromthelongpositionestablishedbytheentrylabeled"OriginalEntry",atMarketpriceonopenofnextbar:

SellFromEntry("OriginalEntry")NextBarAtOpen;

Sell10sharesofthelongpositionestablishedbytheentrylabeled"OriginalEntry",atMarketpriceonopenofnextbar:

SellEntry("OriginalEntry")10SharesNextBarAtMarket;

Sell5contractsforallopenlongentriesatMarketpriceonopenofnextbar:

Sell5ContractsNextBarMarket;

Sellatotalof1share,regardlessofthenumberofopenlongentries,withinthenextbaronthefirsttickwithapriceof100ormore(thelongest-heldsharewillbesoldifthepriceismet):

Sell1ShareTotalNextBarAt100Limit;

Completelyexitalllongentrieswithinthenextbaronthefirsttickwithapriceof50orless:

SellNextBar50Stop;

692

SellShortEntersashortpositionasspecifiedbytheparameters.

TheentrypointisvisuallyindicatedonachartbyanArrowandaTick.TheArrowidentifiesthetimeandtheTickidentifiesthepricevalueoftheentrypoint.Labels,displayingtheentrynameandthenumberofcontractsorsharestraded,aredisplayedabovetheShortArrow.

Anorderisexecutedatthepointspecifiedbytheparameters;iftheorderisnotfilledwithinthespecifiedbar,theorderiscancelled.

WhenaSellShortorderisfilled,anyopenlongpositionswillalsobeclosed.

Usage

SellShort[("EntryLabel")][TradeSize]Entry

or:

SellShort[("EntryLabel")][TradeSize]Entry

Parametersinsidethesquarebracketsareoptional

Parameters

EntryLabel-anoptionalparameter;assignsanamethatwillbedisplayedinthenamelabelabovetheentry,andcanbeusedtoidentifytheparticularentryandtotieanexittoit.

Anexitcanonlybetiedtoanentrywithinthesamesignal;formoreinformation,seeBuyToCover.

IfEntryLabelisnotspecified,thename"Short"willbeusedforthefirstentry,"Short#2"forthesecondentry,"Short#3"forthethirdentry,etc.

TradeSize-anoptionalparameter;anumericalexpression,specifyingthenumberofcontractsorsharestosellshort;theexpressionmustbefollowedbyoneofthefollowingtransposablewords:Share,Shares,ContractorContracts.

693

IfTradeSizevalueequals0orisnegative,ashortpositionwillnotbeenteredbutanyopenlongpositionswillbeclosed.

IfTradeSizeisnotspecified,thetradesizevaluesetbytheuserinthePropertiestaboftheStrategyPropertieswindowwillbeused.

Entry-arequiredparameter;specifiesthetimingandpriceofentry.

TherearefourtypesofEntry:

ThisBar[On]Close

Where:-Onisaskipwordandcanbeomitted

AShortArrowwillbeplacedatthecurrentbar'sClosetick.

NextBar[At]OpenorNextBar[At]Market

Where:-words"Market"and"Open"aretransposable-Atisaskipwordandcanbeomitted

AShortArrowwillbeplacedatthenextbar'sOpentick.

NextBar[At]PriceLimit

Where:-Priceisanumericalexpression,specifyingtheLimitPrice-Atisaskipwordandcanbeomitted

AShortArrowwillbeplacedonthenextbaratthefirsttickwithapriceequaltoorgreaterthanthePrice;iftherearenosuchtickswithinthenextbar,theorderwillbecancelled.

NextBar[At]PriceStop

Where:-Priceisanumericalexpression,specifyingtheStopPrice-Atisaskipwordandcanbeomitted

AShortArrowwillbeplacedonthenextbaratthefirsttickwithapricevaluelessthanorequaltoPrice;iftherearenosuchtickswithinthenextbar,theorderwillbecancelled.

694

Example

SellShortauser-setnumberofsharesatMarketpriceoncloseofthisbar:

SellShortThisBarOnClose;

SellShort1shareatMarketpriceonopenofnextbarandlabeltheentry"Entry":

SellShort("Entry")1ShareNextBarAtOpen;

SellShort1contractatMarketpriceonopenofnextbarandlabeltheentry"Entry":

SellShort("Entry")1ContractNextBarMarket;

SellShort2shareswithinthenextbaronthefirsttickwithapriceof100ormore:

SellShort2SharesNextBarAt100Limit;

SellShort10contractswithinthenextbaronthefirsttickwithapriceof50orless:

SellShort10ContractsNextBar50Stop;

695

SetBreakEvenClosesouttheentirepositionortheentryifitisatthebreakevenpointaftertheprofithasreachedthespecifiedvalue;generatestheappropriateStoporderdependingonwhetherthepositionislongorshort.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhetherSetBreakEvenwillbeappliedtotheentirepositionortoeachcontractorshareindividually;bydefault,SetBreakEvenisappliedtotheentireposition.

SetBreakEvenfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetBreakEven(Profit)

Where:Profit-anumericalexpression,specifyingthecurrencyvalueoftheprofitthatmustbereachedfirst

Notes

Thisfunctioncanonlybeusedinsignals.

SetBreakEvenfunctiondoesnotfactorincommissionsorslippage.

Amountcanbeseteitherinthecurrencyofthesymbolorinthecurrecyofthestrategy,dependingonthekeysetinWindowsRegistry.

GotoHKEY_CURRENT_USER\Software\TSSupport\[ProductName]\StrategyPropandcreateakeyDWORDValue:SpecOrdersAmountIsStrategyCurr.

0-tocalculateAmountinthecurrencyofthesymbol.

1-tocalculateAmountinthecurrencyofthestrategy/Portfolio(bydefault).

[ProductName]isnameofproduct,forexample,for32-bitMultiCharts="MultiCharts",for64-bitversion="MultiCharts64".

696

Ifthereisnosuchakey,Amountiscalculatedinthecurrencyofthestrategy/Portfolio.

Example

Generateanexitorderfortheentirepositionifitisatthebreakevenpointafterpositionprofithasreached¤50:

SetStopPosition;

SetBreakEven(50);

Generateanexitorderfortheentryifitisatthebreakevenpointafterpercontractprofithasreached¤10:

SetStopContract;

SetBreakEven(10);

697

SetBreakEven_ptClosesouttheentirepositionortheentryifitisatthebreakevenpointaftertheprofithasreachedthespecifiedtickvalue;generatestheappropriateStoporderdependingonwhetherthepositionislongorshort.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhethersingleSetBreakEven_ptorderwillbeappliedtotheentirepositionormultipleSetBreakEven_ptorderswillbeappliedtoeachentryinpositionindividually;bydefault,SetBreakEven_ptisappliedtotheentireposition.

SetBreakEven_ptfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetBreakEven_pt(Profit)

Where:Profit-anumericalexpression,specifyingtheamountoftheprofitinticksthatmustbereachedfirst

Notes

Thisfunctioncanonlybeusedinsignals.

SetBreakEven_ptfunctiondoesnotfactorincommissionsorslippage.

Example

Generateanexitorderfortheentirepositionifitisatthebreakevenpointafterpositionprofithasreached50ticks:

SetStopPosition;

SetBreakEven_pt(50);

Generateanexitorderfortheentryifitisatthebreakevenpointafterperentery

698

profithasreached10ticks:

SetStopContract;

SetBreakEven_pt(10);

699

SetDollarTrailingClosesouttheentirepositionortheentryifthecurrentprofitislessthanthemaximumprofitbythespecifiedamount;generatestheappropriateStoporderdependingonwhetherthepositionislongorshort.

Forexample,ifthespecifiedammountis¤50andtheprofithasreachedthemaximumof¤120,thepositionwillbeclosedoncetheprofitdropsto¤70.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhetherSetDollarTrailingwillbeappliedtotheentirepositionortoeachcontractorshareindividually;bydefault,SetDollarTrailingisappliedtotheentireposition.

SetDollarTrailingfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetDollarTrailing(Amount)

Where:Amount-anumericalexpression,specifyingthecurrencyvalueofthemaximumlossofprofit

Notes

Thisfunctioncanonlybeusedinsignals.

Amountcanbeseteitherinthecurrencyofthesymbolorinthecurrecyofthestrategy,dependingonthekeysetinWindowsRegistry.

GotoHKEY_CURRENT_USER\Software\TSSupport\[ProductName]\StrategyPropandcreateakeyDWORDValue:SpecOrdersAmountIsStrategyCurr.

0-tocalculateAmountinthecurrencyofthesymbol.

1-tocalculateAmountinthecurrencyofthestrategy/Portfolio(bydefault).

[ProductName]isnameofproduct,forexample,for32-bitMultiCharts=

700

"MultiCharts",for64-bitversion="MultiCharts64".

Ifthereisnosuchakey,Amountiscalculatedinthecurrencyofthestrategy/Portfolio.

Example

Generateanexitorderfortheentirepositionifpositionprofitdropsby¤50:

SetStopPosition;

SetDollarTrailing(50);

Generateanexitorderfortheentryifpercontractprofitdropsby¤10:

SetStopContract;

SetDollarTrailing(10);

701

SetExitOnCloseClosesoutthecurrentpositionattheClosetickofthelastbarofthetradingsessiononanintra-daychart;generatestheappropriateMarketexitorderdependingonwhetherthepositionislongorshort.

SetExitOnClosefunctionusesthesessionclosingtimespecifiedinthesessionsettingsforthesymbolintheQuoteManager.

Usage

SetExitOnClose

Notes

Thisfunctioncanonlybeusedinsignals.

Example

GenerateanexitorderattheClosetickofthelastbarofthetradingsession:

SetExitOnClose;

702

SetPercentTrailingClosesouttheentirepositionortheentryifthespecifiedpercentageofthemaximumprofitislostaftertheprofithasreachedthespecifiedvalue;generatestheappropriateStoporderdependingonwhetherthepositionislongorshort.

Forexample,ifthespecifiedprofitis¤100andthespecifiedpercentageis50,andtheprofithasreachedthemaximumof¤120,thepositionwillbeclosedoncetheprofitfallsbackto¤60.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhetherSetPercentTrailingwillbeappliedtotheentirepositionoreachcontractorshareindividually;bydefault,SetPercentTrailingisappliedtotheentireposition.

SetPercentTrailingfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetPercentTrailing(Profit,Percentage)

Where:Profit-anumericalexpression,specifyingthecurrencyvalueoftheprofitthatmustbereachedfirstPercentage-anumericalexpression,specifyingthemaximumlossofprofitinpercent

Notes

Thisfunctioncanonlybeusedinsignals.

Amountcanbeseteitherinthecurrencyofthesymbolorinthecurrecyofthestrategy,dependingonthekeysetinWindowsRegistry.

GotoHKEY_CURRENT_USER\Software\TSSupport\[ProductName]\StrategyPropandcreateakeyDWORDValue:SpecOrdersAmountIsStrategyCurr.

0-tocalculateAmountinthecurrencyofthesymbol.

703

1-tocalculateAmountinthecurrencyofthestrategy/Portfolio(bydefault).

[ProductName]isnameofproduct,forexample,for32-bitMultiCharts="MultiCharts",for64-bitversion="MultiCharts64".

Ifthereisnosuchakey,Amountiscalculatedinthecurrencyofthestrategy/Portfolio.

Example

Generateanexitorderfortheentirepositionif50percentofmaximumpositionprofitislostaftertheprofithasreached¤25:

SetStopPosition;

SetPercentTrailing(25,50);

Generateanexitorderfortheentryif25percentofmaximumpershareprofitislostaftertheprofithasreached¤5:

SetStopShare;

SetPercentTrailing(5,25);

704

SetPercentTrailing_ptClosesouttheentirepositionortheentryifthespecifiedpercentageofthemaximumprofitislostaftertheprofithasreachedthespecifiedtickvalue;generatestheappropriateStoporderdependingonwhetherthepositionislongorshort.

Forexample,ifthespecifiedprofitis100ticksandthespecifiedpercentageis50,andtheprofithasreachedthemaximumof120ticks,thepositionwillbeclosedoncetheprofitfallsbackto60ticks.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhethersingleSetPercentTrailing_ptorderwillbeappliedtotheentirepositionormultipleSetPercentTrailing_ptorderswillbeappliedtoeachentryinpositionindividually;bydefault,SetPercentTrailing_ptisappliedtotheentireposition.

SetPercentTrailing_ptfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetPercentTrailing_pt(Profit,Percentage)

Where:Profit-anumericalexpression,specifyingthetickvalueoftheprofitthatmustbereachedfirstPercentage-anumericalexpression,specifyingthemaximumlossofprofitinpercent

Notes

Thisfunctioncanonlybeusedinsignals.

SetPercentTrailing_ptfunctiondoesnotfactorincommissionsorslippage.

Example

Generateanexitorderfortheentirepositionif50percentofmaximumposition

705

profitislostaftertheprofithasreached25ticks:

SetStopPosition;

SetPercentTrailing_pt(25,50);

Generateanexitorderfortheentryif25percentofmaximumperentryprofitislostaftertheprofithasreached5ticks:

SetStopShare;

SetPercentTrailing_pt(5,25);

706

SetProfitTargetClosesouttheentirepositionortheentryifprofitreachesthespecifiedcurrencyvalue;generatestheappropriateLimitexitorderdependingonwhetherthepositionislongorshort.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhethertheprofittargetwillbeappliedtotheentirepositionortoeachcontractorshareindividualy;bydefault,profittargetisappliedtotheentireposition.

SetProfitTargetfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetProfitTarget(Amount)

Where:Amount-anumericalexpression,specifyingtheprofittargetamount

Notes

Thisfunctioncanonlybeusedinsignals.

Amountcanbeseteitherinthecurrencyofthesymbolorinthecurrecyofthestrategy,dependingonthekeysetinWindowsRegistry.

GotoHKEY_CURRENT_USER\Software\TSSupport\[ProductName]\StrategyPropandcreateakeyDWORDValue:SpecOrdersAmountIsStrategyCurr.

0-tocalculateAmountinthecurrencyofthesymbol.

1-tocalculateAmountinthecurrencyofthestrategy/Portfolio(bydefault).

[ProductName]isnameofproduct,forexample,for32-bitMultiCharts="MultiCharts",for64-bitversion="MultiCharts64".

Ifthereisnosuchakey,Amountiscalculatedinthecurrencyofthestrategy/Portfolio.

707

Example

Generateanexitorderfortheentirepositionifthepositionprofitreaches¤100:

SetStopPosition;

SetProfitTarget(100);

Generateanexitorderfortheentryiftheprofitpercontractreaches¤10:

SetStopContract;

SetProfitTarget(10);

708

SetProfitTarget_ptClosesouttheentirepositionortheentryifprofitreachesthespecifiedtickvalue;generatestheappropriateLimitexitorderdependingonwhetherthepositionislongorshort.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhethersingleprofittargetorderwillbeappliedtotheentirepositionormultipleSetProfitTarget_ptorderswillbeappliedtoeachentryinpositionindividualy;bydefault,profittargetisappliedtotheentireposition.

SetProfitTarget_ptfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetProfitTarget_pt(Amount)

Where:Amount-anumericalexpression,specifyingtheprofittargetamountinticks.

Notes

Thisfunctioncanonlybeusedinsignals.

SetProfitTarget_ptfunctiondoesnotfactorincommissionsorslippage.

Example

Generateanexitorderfortheentirepositionifthepositionprofitreaches100ticks:

SetStopPosition;

SetProfitTarget_pt(100);

Generateanexitorderfortheentryiftheprofitperentryreaches10ticks:

709

SetStopContract;

SetProfitTarget_pt(10);

710

SetStopContractForcesthebuilt-instrategyexitfunctionstobeappliedonpercontractorsharebasis.

Thebuilt-instrategyexitfunctionsare:SetStopLoss,SetProfitTarget,SetBreakEven,SetDollarTrailing,andSetPercentTrailing.

Usage

SetStopContract

Notes

IfSetStopPositon,SetStopContract,andSetStopSharewerenotused,theexitfunctionswillbeappliedontheentirepositionbasisasadefault.

IfSetStopPositon,SetStopContract,andSetStopSharewereusedinmultipleinstancesorindifferentsignalsappliedtothesamechart,thelastinstancewillbecontrolling.

Example

ForcetheSetStopLossstrategyexitfunctiontobeappliedonpercontractbasis:

SetStopContract;

SetStopLoss(10);

Anexitorderfortheentrywillbegeneratedifthelosspercontractreaches¤10.

711

SetStopLossClosesouttheentirepositionortheentryifthelossreachesthespecifiedcurrencyvalue;generatestheappropriateStoporderdependingonwhetherthepositionislongorshort.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhetherthestoplosswillbeappliedtotheentirepositionortoeachcontractorshareindividually;bydefault,stoplossisappliedtotheentireposition.

SetStopLossfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetStopLoss(Amount)

Where:Amount-anumericalexpression,specifyingthestoplossamount

Notes

Thisfunctioncanonlybeusedinsignals.

Amountcanbeseteitherinthecurrencyofthesymbolorinthecurrecyofthestrategy,dependingonthekeysetinWindowsRegistry.

GotoHKEY_CURRENT_USER\Software\TSSupport\[ProductName]\StrategyPropandcreateakeyDWORDValue:SpecOrdersAmountIsStrategyCurr.

0-tocalculateAmountinthecurrencyofthesymbol.

1-tocalculateAmountinthecurrencyofthestrategy/Portfolio(bydefault).

[ProductName]isnameofproduct,forexample,for32-bitMultiCharts="MultiCharts",for64-bitversion="MultiCharts64".

Ifthereisnosuchakey,Amountiscalculatedinthecurrencyofthestrategy/Portfolio.

712

Example

Generateanexitorderfortheentirepositionifthepositionlossreaches¤100:

SetStopPosition;

SetStopLoss(100);

Generateanexitorderfortheentryifthelosspercontractreaches¤10:

SetStopContract;

SetStopLoss(10);

713

SetStopLoss_ptClosesouttheentirepositionortheentryifthelossreachesthespecifiedtickvalue;generatestheappropriateStoporderdependingonwhetherthepositionislongorshort.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhethersinglestoplosswillbeappliedtotheentirepositionormultipleSetStopLoss_ptorderswillbeappliedtoeachentryinpositionindividually;bydefault,stoplossisappliedtotheentireposition.

SetStopLoss_ptfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetStopLoss_pt(Amount)

Where:Amount-anumericalexpression,specifyingthestoplossamountinticks.

Notes

Thisfunctioncanonlybeusedinsignals.

SetStopLoss_ptfunctiondoesnotfactorincommissionsorslippage.

Example

Generateanexitorderfortheentirepositionifthepositionlossreaches100ticks:

SetStopPosition;

SetStopLoss_pt(100);

Generateanexitorderfortheentryifthelossperentryreaches10ticks:

SetStopContract;

714

SetStopLoss_pt(10);

715

SetStopPositionForcesthebuilt-instrategyexitfunctionstobeappliedontheentirepositionbasis.

Thebuilt-instrategyexitfunctionsare:SetStopLoss,SetProfitTarget,SetBreakEven,SetDollarTrailing,andSetPercentTrailing.

Usage

SetStopPosition

Notes

IfSetStopPositon,SetStopContract,andSetStopSharewerenotused,theexitfunctionswillbeappliedontheentirepositionbasisasadefault.

IfSetStopPositon,SetStopContract,andSetStopSharewereusedinmultipleinstancesorindifferentsignalsappliedtothesamechart,thelastinstancewillbecontrolling.

Example

ForceSetStopLossstrategyexitfunctiontobeappliedontheentirepositionbasis:

SetStopPosition;

SetStopLoss(100);

Anexitorderfortheentirepositionwillbegeneratedifthepositionlossreaches¤100.

716

SetStopShareSameasSetStopContract

717

SetTrailingStop_ptClosesouttheentirepositionortheentryifthecurrentprofitislessthanthemaximumprofitbythespecifiedamount;generatestheappropriateStoporderdependingonwhetherthepositionislongorshort.

Forexample,ifthespecifiedammountis50ticksandtheprofithasreachedthemaximumof120ticks,thepositionwillbeclosedoncetheprofitdropsto70ticks.

SetStopPositionandSetStopContractorSetStopSharefunctionsdeterminewhetherSetTrailingStop_ptwillbeappliedtotheentirepositionortoeachentryinpositionindividually;bydefault,SetTrailingStop_ptisappliedtotheentireposition.

SetTrailingStop_ptfunctionisevaluatedintra-barandnotonlyoncloseofabar,andcanexitwithinthesamebarastheentry.

Usage

SetDollarTrailing_pt(Amount)

Where:Amount-anumericalexpression,specifyingthetickvalueofthemaximumlossofprofitinticks.

Notes

Thisfunctioncanonlybeusedinsignals.

SetTrailingStop_ptfunctiondoesnotfactorincommissionsorslippage.

Example

Generateanexitorderfortheentirepositionifpositionprofitdropsby50ticks:

SetStopPosition;

SetDollarTrailing_pt(50);

718

Generateanexitorderfortheentryifperentryprofitdropsby10ticks:

SetStopContract;

SetDollarTrailing_pt(10);

719

ShareSameasShares

720

Shares

Usedinstrategyentryorexitstatementsincombinationwithanumericalexpressiontospecifythenumberofsharesorcontractstotrade.

Usage

TradeSizeShares

Where:TradeSize-anumericalexpression,specifyingthenumberofsharesorcontracts

Example

Buy2sharesatMarketpriceonopenofnextbar:

Buy2SharesNextBarAtMarket;

721

Short

UsedincombinationwiththewordSell;sameasSellShort.

Usage

SellShort[("EntryLabel")][TradeSize]Entry;

722

StopUsedinstrategyentryorexitstatementstospecifyaStoppriceforanentryoranexit.

AStoporderwillexecuteatthespecifiedpriceorworse.AworsepriceisahigherpriceforBuyandBuytocoverorders,andalowerpriceforSellandSellshortorders.

Usage

AtPriceStop

Where:Price-anumericalexpression,specifyingtheLimitPriceAt-askipwordandcanbeomitted

Example

Sellwithinthenextbaronthefirsttickwithapriceof100orless:

SellNextBar100Stop;

Coverwithinthenextbaronthefirsttickwithapriceof50ormore:

BuyToCoverNextBarAt50Stop;

723

TotalUsedinstrategyexitstatements,followinganumericalexpressionandthewordsSharesorContracts,toindicatethatonlythenumberofcontractsorsharesspecifiedbythenumericalexpressionistobesoldorcoveredintotal,regardlessofthenumberofopenentries.Thecontractsorshareswillbesoldorcoveredinthesameordertheywereboughtorshorted:FirstIn,FirstOut.

IfthewordTotalisnotused,thenumberofcontractsorsharesspecifiedbythenumericalexpressionwillbesoldorcoveredforeachoneoftheopenentries.

Usage

TradeSizeSharesTotal

Where:TradeSize-anumericalexpression,specifyingthenumberofsharesorcontracts

Example

Sellatotalof2contracts,regardlessofthenumberofopenlongentries,atMarketpriceonopenofnextbar:

Sell2ContractsTotalNextBarAtMarket;

724

AvgBarsEvenTradeReturnsanumericalvalue,indicatingtheaveragenumberofbarsapositionwasheldduringallcompletedeventrades.

Usage

AvgBarsEvenTrade

Notes

Thisfunctioncanonlybeusedinsignals.

Example

AvgBarsEvenTradewillreturnavalueof3.5iffoureventradesheldpositionsfor2,5,3,and4bars

725

AvgBarsLosTradeReturnsanumericalvalue,indicatingtheaveragenumberofbarsapositionwasheldduringallcompletedlosingtrades.

Usage

AvgBarsLosTrade

Notes

Thisfunctioncanonlybeusedinsignals.

Example

AvgBarsLosTradewillreturnavalueof3.5iffourlosingtradesheldpositionsfor2,5,3,and4bars

726

AvgBarsWinTradeReturnsanumericalvalue,indicatingtheaveragenumberofbarsapositionwasheldduringallcompletedwinningtrades.

Usage

AvgBarsWinTrade

Notes

Thisfunctioncanonlybeusedinsignals.

Example

AvgBarsWinTradewillreturnavalueof3.5iffourwinningtradesheldpositionsfor2,5,3,and4bars

727

AvgEntryPriceReturnsanumericalvalue,indicatingtheaverageentrypriceforallopenentriesinapyramidedposition.

Usage

AvgEntryPrice

Notes

Thisfunctioncanonlybeusedinsignals.

Example

AvgEntryPricewillreturnavalueof101iftherewerethreeopenentriesat95,105,and103

728

AvgEntryPrice_at_Broker

Returnsanumericalvalue,indicatingtheaverageentrypriceatthebrokerforthesymbol.

Apositivevalueindicatesalongpositionandanegativevalueindicatesashortposition.

Azero('0')isreturnedwhenthecurrentpositionisflat,orifAutomatedTradingisnotturnedon.

Usage

AvgEntryPrice_at_Broker

Notes

Thisfunctioncanonlybeusedinsignalsandfunctions.

Important

IfAutomatedTradingwasmanuallyturnedoffbytheuser,thevaluereturnedbythekeywordstopschanging,andmayremainunequalto'0'.

Example

AvgEntryPrice_at_Brokerwillreturnavalueof102ifbrokerhasreturnedthevalueof102forthecurrenttradinginstrument.

729

AvgEntryPrice_at_Broker_for_The_StrategyReturnsanumericalvalue,indicatingtheaverageentrypriceatthebrokerforthestrategy.

Apositivevalueindicatesalongpositionandanegativevalueindicatesashortposition.

Azero('0')isreturnedwhenthecurrentpositionisflat,orifAutomatedTradingisnotturnedon.

Usage

AvgEntryPrice_at_Broker_for_The_Strategy

Notes

Thisfunctioncanonlybeusedinsignalsandfunctions.

Important

IfAutomatedTradingwasmanuallyturnedoffbytheuser,thevaluereturnedbythekeywordstopschanging,andmayremainunequalto'0'.

Example

AvgEntryPrice_at_Broker_for_The_Strategywillreturnavalueof100ifthereweretwo1contractentriesforthecurrentstrategy:at98and102.

730

GrossLossReturnsanegativenumericalvalue,indicatingthetotalcurrencyvalueofallcompletedlosingtrades.

Usage

GrossLoss

Notes

Thisfunctioncanonlybeusedinsignals.

Example

GrossLosswillreturnavalueof-50iftherewereatotaloffourlosingtrades,at10,5,20,and15

GrossLosswillreturnavalueof0ifnolosingtradeswerecompletedduringtheentiretradingperiod

731

GrossProfitReturnsanumericalvalue,indicatingthetotalcurrencyvalueofallcompletedwinningtrades.

Usage

GrossProfit

Note

Thisfunctioncanonlybeusedinsignals.

Example

GrossProfitwillreturnavalueof50iftherewereatotaloffourwinningtrades,at10,5,20,and15

GrossProfitwillreturnavalueof0ifnowinningtradeswerecompletedduringtheentiretradingperiod

732

i_AvgEntryPriceSameasAvgEntryPriceexceptusedinindicators.

733

i_AvgEntryPrice_at_BrokerReturnstheAverageentrypriceofeachopenentryinapyramidedposition.

Usage

i_AvgEntryPrice_at_Broker

Notes

i_AvgEntryPrice_at_Brokeronlyreturnstheaverageentrypriceforopentrades.

i_AvgEntryPrice_at_Brokercanonlybeusedinanindicator.

i_AvgEntryPrice_at_Brokerwillonlyreturnavalueifasignalisappliedtothesamedata.

Example

i_AvgEntryPrice_at_Brokerreturns170ifthreetradesarecurrentlyopenandwereenteredatapriceof140,170,and200.

i_AvgEntryPrice_at_Brokerreturns53iffourtradesarecurrentlyopenandwereenteredatapriceof54,48,60,and50.

734

i_AvgEntryPrice_at_Broker_for_The_StrategyIsusedfortheextractionofstrategyinformationinindicator.

ReturnsthesameinformationasAvgEntryPrice_at_Broker_for_The_Strategy.

735

i_ClosedEquityReturnstheprofitorlossrealizedwhenapositionhasbeenclosed.

Usage

i_ClosedEquity

Notes

Thisfunctioncanonlybeusedinindicators.

Example

i_ClosedEquitywillreturn100iftheclosedequityis100.

736

i_CurrentContractsSameasCurrentContractsexceptusedinindicators.

737

i_CurrentSharesSameasCurrentSharesexceptusedinindicators.

738

i_MarketPositionReturnsanumericalvalue,indicatingthetypeofthespecifiedposition.

Avalueof1indicatesthecurrentbarhasalongposition,-1indicatesthecurrentbarhasashortposition,and0isreturnedonlyifthecurrentbarhasaflatposition.

Usage

i_MarketPosition

Notes

Thisfunctioncanonlybeusedinindicators.

Example

i_MarketPositionwillreturnavalueof0ifthepositiononthecurrentbarisflat

i_MarketPositionwillreturnavalueof1ifthepositiononthecurrentbarislong

i_MarketPositionwillreturnavalueof-1ifthepositiononthecurrentbarisshort

739

i_OpenEquityReturnsthecurrentequity(netprofit+openpositionprofit)

Usage

i_OpenEquity

Notes

Thisfunctioncanonlybeusedinindicators.

Example

i_OpenEquitywillreturn100ifthecurrentequityis100.

i_OpenEquitywillreturn-100ifthecurrentequityis-100.

740

LargestLosTradeReturnsanegativenumericalvalue,indicatingthecurrencyvalueofthelargestcompletedlosingtrade.

Usage

LargestLosTrade

Notes

Thisfunctioncanonlybeusedinsignals.

Example

LargestLosTradewillreturnavalueof-20iftherewereatotaloffourlosingtradesat10,5,20,and15

LargestLosTradewillreturnavalueof0ifnolosingtradeswerecompletedduringtheentiretradingperiod

741

LargestWinTradeReturnsanumericalvalue,indicatingthecurrencyvalueofthelargestcompletedwinningtrade.

Usage

LargestWinTrade

Notes

Thisfunctioncanonlybeusedinsignals.

Example

LargestWinTradewillreturnavalueof20iftherewereatotaloffourwinningtradesat10,5,20,and15

LargestWinTradewillreturnavalueof0ifnowinningtradeswerecompletedduringtheentiretradingperiod

742

MaxConsecLosersReturnsanumericalvalue,indicatingthenumberoftradesinthelongestsequenceofconsecutivecompletedlosingtrades.

Usage

MaxConsecLosers

Notes

Thisfunctioncanonlybeusedinsignals.

Example

MaxConsecLoserswillreturnavalueof3iftherewerethreeconsecutivecompletedlosingtrades

MaxConsecLoserswillreturnavalueof0ifnolosingtradeswerecompletedduringtheentiretradingperiod

743

MaxConsecWinnersReturnsanumericalvalue,indicatingthenumberoftradesinthelongestsequenceofconsecutivecompletedwinningtrades.

Usage

MaxConsecWinners

Notes

Thisfunctioncanonlybeusedinsignals.

Example

MaxConsecWinnerswillreturnavalueof3iftherewerethreeconsecutivecompletedwinningtrades

MaxConsecWinnerswillreturnavalueof0ifnowinningtradeswerecompletedduringtheentiretradingperiod

744

MaxContractsHeldReturnsanumericalvalue,indicatingthemaximumnumberofcontractsorsharesheldatanyonetime.

Usage

MaxContractsHeld

Notes

Thisfunctioncanonlybeusedinsignals.

Example

MaxContractsHeldwillreturnavalueof10ifamaximumoftencontractswereheldatanyonetime

745

MaxIDDrawDownReturnsanegativenumericalvalue,indicatingthelargestdeclineinequityduringtheentiretradingperiod.

Usage

MaxIDDrawDown

Notes

Thisfunctioncanonlybeusedinsignals.

Example

MaxIDDrawDownwillreturnavalueof-500ifthelargestdeclineinequityduringtheentiretradingperiodwas¤500

746

MaxSharesHeldSameasMaxContractsHeld

747

NetProfitReturnsanumericalvalue,indicatingthetotalcurrencyvalueofallcompletedtrades.

Usage

NetProfit

Notes

Thisfunctioncanonlybeusedinsignals.

Example

NetProfitwillreturnavalueof20iftherewerewinningtradesat25and10,andlosingtradesat5and10

NetProfitwillreturnavalueof-15iftherewerewinningtradesat10and5,andlosingtradesat20and10

NetProfitwillreturnavalueof0notradeswerecompletedduringtheentiretradingperiod

748

NumEvenTradesReturnsanumericalvalue,indicatingthetotalnumberofallcompletedeventrades.

Usage

NumEvenTrades

Notes

Thisfunctioncanonlybeusedinsignals.

Example

NumEvenTradeswillreturnavalueof10ifthereweretencompletedeventrades

NumEvenTradeswillreturnavalueof0ifnoeventradeswerecompletedduringtheentiretradingperiod

749

NumLosTradesReturnsanumericalvalue,indicatingthenumberofallcompletedlosingtrades.

Usage

NumLosTrades

Notes

Thisfunctioncanonlybeusedinsignals.

Example

NumLosTradeswillreturnavalueof5iftherewereatotaloffivecompletedlosingtrades

NumLosTradeswillreturnavalueof0ifnolosingtradeswerecompletedduringtheentiretradingperiod

750

NumWinTradesReturnsanumericalvalue,indicatingthenumberofallcompletedwinningtrades.

Usage

NumWinTrades

Notes

Thisfunctioncanonlybeusedinsignals.

Example

NumWinTradeswillreturnavalueof5iftherewereatotaloffivecompletedwinningtrades

NumWinTradeswillreturnavalueof0ifnowinningtradeswerecompletedduringtheentiretradingperiod

751

PercentProfitReturnsanumericalvalue,indicatingthepercentageofwinningtradesinalltradescompleted.

Usage

PercentProfit

Notes

Thisfunctioncanonlybeusedinsignals.

Example

PercentProfitwillreturnavalueof70ifsevenoutofthetotalof10completedtradeswerewinningtrades

752

SetCustomFitnessValue

Setsavalueofthecustomcriterionthatistobeusedforoptimization.

Usage

SetCustomFitnessValue(Criterion)

Where:Criterion-anexpressionspecifyingacustomcriterionvalue.

Note

ThisfunctioncanbeusedonlyinsignalsTousethecustomfitnessvalue:1. Opengeneticalgorithmpropertieswindow;2. Setthenumberofsimulationsbychangingtheinputsrange;3. SelecttheAlgorithm-SpecifiedPropertiestab;4. SelecttheCustomFitnessValuefromthelistundertheStandard

Criteriasection.

Example

Setthegrossprofittobeacustomcriterionforgeneticoptimization

SetCustomFitnessValue(GrossProfit);

Settheformulatobeacustomcriterionforgeneticoptimization

SetCustomFitnessValue(TotalTrades/(GrossLoss+GrossProfit));

753

TotalBarsEvenTradesReturnsanumericalvalue,indicatingthetotalnumberofbarsapositionwasheldduringallcompletedeventrades.

Usage

TotalBarsEvenTrades

Notes

Thisfunctioncanonlybeusedinsignals.

Example

TotalBarsEvenTradeswillreturnavalueof14iffoureventradesheldpositionsfor2,5,3,and4bars

TotalBarsEvenTradeswillreturnavalueof0ifnoeventradeswerecompletedduringtheentiretradingperiod

754

TotalBarsLosTradesReturnsanumericalvalue,indicatingthetotalnumberofbarsapositionwasheldduringallcompletedlosingtrades.

Usage

TotalBarsLosTrades

Notes

Thisfunctioncanonlybeusedinsignals.

Example

TotalBarsLosTradeswillreturnavalueof14iffourlosingtradesheldpositionsfor2,5,3,and4bars

TotalBarsLosTradeswillreturnavalueof0ifnolosingtradeswerecompletedduringtheentiretradingperiod

755

TotalBarsWinTradesReturnsanumericalvalue,indicatingthetotalnumberofbarsapositionwasheldduringallcompletedwinningtrades.

Usage

TotalBarsWinTrades

Notes

Thisfunctioncanonlybeusedinsignals.

Example

TotalBarsWinTradeswillreturnavalueof14iffourwinningtradesheldpositionsfor2,5,3,and4bars

TotalBarsWinTradeswillreturnavalueof0ifnowinningtradeswerecompletedduringtheentiretradingperiod

756

TotalTradesReturnsanumericalvalue,indicatingthetotalnumberofallcompletedtrades.

Usage

TotalTrades

Notes

Thisfunctioncanonlybeusedinsignals.

Example

TotalTradeswillreturnavalueof5iftherewereatotaloffivecompletedtrades

TotalTradeswillreturnavalueof0ifnotradeswerecompletedduringtheentiretradingperiod

757

BarsSinceEntry

Returnsanumericalvalue,indicatingthenumberofbarssincetheinitialentryintothespecifiedposition.

Usage

BarsSinceEntry(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthenumberofbarssincethecurrentpositionhasbeenentered,toValue1variable:

Value1=BarsSinceEntry;

Assignavalue,indicatingthenumberofbarssincethemostrecentlyclosedpositionhasbeenentered,toValue1variable:

Value1=BarsSinceEntry(1);

758

BarsSinceEntry_Checked

Returnsanumericalvalue,indicatingthenumberofbarssincetheinitialentryintothespecifiedposition.

Usage

BarsSinceEntry_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,BarsSinceEntry_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingthenumberofbarssincethecurrentpositionhasbeenentered,toValue1variable:

Value1=BarsSinceEntry_Checked;

Assignavalue,indicatingthenumberofbarssincethemostrecentlyclosedpositionhasbeenentered,toValue1variable:

Value1=BarsSinceEntry_Checked(1);

759

BarsSinceExit

Returnsanumericalvalue,indicatingthenumberofbarssinceacompleteexitfromthespecifiedposition.

Usage

BarsSinceExit(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

1-thelastpositionclosed(onepositionback);2-twopositionsback,etc.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthenumberofbarssincethelastpositionhasbeenclosed,toValue1variable:

Value1=BarsSinceExit(1);

760

BarsSinceExit_Checked

Returnsanumericalvalue,indicatingthenumberofbarssinceacompleteexitfromthespecifiedposition.

Usage

BarsSinceExit_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,BarsSinceExit_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingthenumberofbarssincethelastpositionhasbeenclosed,toValue1variable:

Value1=BarsSinceExit_Checked(1);

761

ContractProfit

Returnsanumericalvalue,indicatingthecurrentprofitorlosspereachcontractorshareofamulti-shareormulti-contractposition.

Usage

ContractProfit

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthecurrentprofitorlosspercontractorshare,toValue1variable:

Value1=ContractProfit;

762

CurrentContracts

Returnsanabsolutenumericalvalue,indicatingthenumberofcontractsorsharesheldinthecurrentposition.

Usage

CurrentContracts

Notes

Thisfunctioncanonlybeusedinsignals.

Example

CurrentContractswillreturnavalueof1for1contractlong

CurrentContractswillreturnavalueof5for5sharesshort

763

CurrentEntries

Returnsanumericalvalue,indicatingthenumberofopenentriesforthecurrentposition.

Usage

CurrentEntries

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthenumberofopenentriesinthecurrentposition,toValue1variable:

Value1=CurrentEntries;

764

CurrentSharesSameasCurrentContracts

765

EntryDate

Returnsanumericalvalue,indicatingthedateofinitialentryintothespecifiedposition.ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

EntryDate(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthedatethatthecurrentpositionhasbeenentered,toValue1variable:

Value1=EntryDate;

Value1willequalto1081030fortheentrydateofOctober30th,2008

Assignavalue,indicatingthedatethatthemostrecentlyclosedpositionhasbeenentered,toValue1variable:

Value1=EntryDate(1);

766

Value1willequalto990402fortheentrydateofApril2nd,1999

767

EntryDateTime

Returnsadouble-precisiondecimalDateTimevalueindicatingthedateandtimeofthebarwheretheorderthatopenedaspecifiedpositionwasgenerated.TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

EntryDateTime(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthedatethatthecurrentpositionhasbeenentered,toValue1variable:

Value1=EntryDateTime;

768

EntryDateTime_Checked

Returnsadouble-precisiondecimalDateTimevalueindicatingthedateandtimeofthebarwheretheorderthatopenedaspecifiedpositionwasgenerated.TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

EntryDateTime_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

IfPosBackvalueisgreaterthattherealnumberofpreviouslyopenedpositions,EntryDateTime_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingthedatethatthecurrentpositionhasbeenentered,toValue1variable:

Value1=EntryDateTime_Checked;

769

EntryDate_Checked

Returnsanumericalvalue,indicatingthedateofinitialentryintothespecifiedposition.

ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

EntryDate_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,EntryDate_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingthedatethatthecurrentpositionhasbeenentered,toValue1variable:

Value1=EntryDate_Checked;

Value1willequalto1081030fortheentrydateofOctober30th,2008

Assignavalue,indicatingthedatethatthemostrecentlyclosedpositionhasbeen

770

entered,toValue1variable:

Value1=EntryDate_Checked(1);

Value1willequalto990402fortheentrydateofApril2nd,1999

771

EntryName

Returnsthenameoftheorderwhichopenedtheposition.

Usage

EntryName(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

Notes

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Example

EntryName(1)willreturnavalueof"buyLE"forthelastclosedposition,ifthispositionwasopenedbytheorderwith"buyLE"name.

772

EntryPrice

Returnsanumericalvalue,indicatingthepriceattheinitialentryintothespecifiedposition.

Usage

EntryPrice(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingtheentrypriceforthecurrentposition,toValue1variable:

Value1=EntryPrice;Assignavalue,indicatingtheentrypriceforthemostrecentlyclosedposition,toValue1variable:

Value1=EntryPrice(1);

773

EntryPrice_Checked

Returnsanumericalvalue,indicatingthepriceattheinitialentryintothespecifiedposition.

Usage

EntryPrice_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,EntryPrice_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingtheentrypriceforthecurrentposition,toValue1variable:

Value1=EntryPrice_Checked;

Assignavalue,indicatingtheentrypriceforthemostrecentlyclosedposition,toValue1variable:

Value1=EntryPrice_Checked(1);

774

EntryTime

Returnsanumericalvalue,indicatingthetimeofinitialentryintothespecifiedposition.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

EntryTime(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthetimethatthecurrentpositionhasbeenentered,toValue1variable:

Value1=EntryTime;

Value1willequalto1015for10:15AM

Assignavalue,indicatingthetimethatthemostrecentlyclosedpositionhasbeenentered,toValue1variable:

Value1=EntryTime(1);

Value1willequalto1545for3:45PM

775

776

EntryTime_Checked

Returnsanumericalvalue,indicatingthetimeofinitialentryintothespecifiedposition.

Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

EntryTime_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,EntryTime_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingthetimethatthecurrentpositionhasbeenentered,toValue1variable:

Value1=EntryTime_Checked;

Value1willequalto1015for10:15AM.

Assignavalue,indicatingthetimethatthemostrecentlyclosedpositionhasbeenentered,toValue1variable:

777

Value1=EntryTime_Checked(1);

Value1willequalto1015for10:15AM.

778

ExitDate

Returnsanumericalvalue,indicatingthedateofthecompleteexitfromthespecifiedposition.ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

ExitDate(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

1-thelastpositionclosed(onepositionback);2-twopositionsback,etc.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthedatethatthemostrecentlyclosedpositionhasbeenexited,toValue1variable:

Value1=ExitDate(1);

Value1willequalto1081030fortheexitdateofOctober30th,2008

779

ExitDateTime

Returnsadouble-precisiondecimalDateTimevalueindicatingthedateandtimeofthebarwheretheorderthatclosedaspecifiedpositionwasgenerated.TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

ExitDateTime(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

1-thelastpositionclosed(onepositionback);2-twopositionsback,etc.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthedatethatthemostrecentlyclosedpositionhasbeenexited,toValue1variable:

Value1=ExitDateTime(1);

780

ExitDateTime_Checked

Returnsadouble-precisiondecimalDateTimevalueindicatingthedateandtimeofthebarwheretheorderthatclosedaspecifiedpositionwasgenerated.TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

ExitDateTime_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

1-thelastpositionclosed(onepositionback);2-twopositionsback,etc.

Notes

Thisfunctioncanonlybeusedinsignals.

IfPosBackvalueisgreaterthattherealnumberofpreviouslyopenedpositions,ExitDateTime_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingthedatethatthemostrecentlyclosedpositionhasbeenexited,toValue1variable:

Value1=ExitDateTime_Checked(1);

781

ExitDate_Checked

Returnsanumericalvalue,indicatingthedateofthecompleteexitfromthespecifiedposition.ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

ExitDate_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

1-thelastpositionclosed(onepositionback);2-twopositionsback,etc.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,ExitDate_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingthedatethatthemostrecentlyclosedpositionhasbeenexited,toValue1variable:

Value1=ExitDate_Checked(1);

Value1willequalto1081030fortheexitdateofOctober30th,2008.

782

ExitName

Returnsthenameoftheorderwhichclosedtheposition.

Usage

ExitName(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

Notes

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Example

ExitName(1)willreturnavalueof"sellLX"forthelastclosedposition,ifthispositionwasclosedbytheorderwith"sellLX"name.

783

ExitPrice

Returnsanumericalvalue,indicatingthepriceatacompleteexitfromthespecifiedposition.

Usage

ExitPrice(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

1-thelastpositionclosed(onepositionback);2-twopositionsback,etc.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingtheexitpriceofthemostrecentlyclosedposition,toValue1variable:

Value1=ExitPrice(1);

784

ExitPrice_Checked

Returnsanumericalvalue,indicatingthepriceatacompleteexitfromthespecifiedposition.

Usage

ExitPrice_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,ExitPrice_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingtheexitpriceofthemostrecentlyclosedposition,toValue1variable:

Value1=ExitPrice_Checked(1);

785

ExitTime

Returnsanumericalvalue,indicatingthetimeatthecompleteexitfromthespecifiedposition.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

ExitTime(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

1-thelastpositionclosed(onepositionback);2-twopositionsback,etc.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthetimethatthemostrecentlyclosedpositionhasbeenexited,toValue1variable:

Value1=ExitTime(1);

Value1willequalto1545for3:45PM

786

ExitTime_Checked

Returnsanumericalvalue,indicatingthetimeatthecompleteexitfromthespecifiedposition.Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

ExitTime_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,ExitTime_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingthetimethatthemostrecentlyclosedpositionhasbeenexited,toValue1variable:

Value1=ExitTime_Checked(1);

Value1willequalto1545for3:45PM.

787

i_MarketPosition_at_BrokerReturnsanumericalvalue,indicatingthenumberofcontractsandthetypeofpositionatthebrokerforthesymbol.

Apositivevalueindicatesalongpositionandanegativevalueindicatesashortposition.

Azero('0')isreturnedwhenthecurrentpositionisflat,orifAutomatedTradingisnotturnedon.

Usage

i_MarketPosition_at_Broker

Notes

Thisfunctioncanonlybeusedinindicators.

Thisfunctiondiffersfromthemarketpositionkeywordinthatitcannottakeanargumenttoreferencepastvalues.Bysavingthevalueofi_MarketPosition_at_BrokertoaNumericVariable,it'spossibletoreferencethepositionatthebrokerforpreviousbarsortick.

I_MarketPosition_at_Brokerworkswithallbrokers,thoughtherearesomepeculiaritieswithMIGBankandTradingTechnologies:ForMIGBank,MultiChartscalculatesthebrokerpositionafterthebrokerprofilehasbeenconnectedsincethisisn'tprovidedbyMIGBank.TheTradingTechnologiesAPIdoesn'tprovideinformationaboutpositionsopenedthedaybefore,inwhichcaseMultiChartsusestheaverageofallcompletelong(short)tradesforthedaytocalculatetheEntryPrice.

Important

IfAutomatedTradingwasmanuallyturnedoffbytheuser,thevaluereturnedbythekeywordstopschanging,andmayremainunequalto'0'.

788

Example

i_MarketPosition_at_Brokerwillwillreturn'17'ifthecurrentpositionatthebrokerforthestrategyis17contractslong.

i_MarketPosition_at_Brokerwillreturn'-132'ifthecurrentpositionatthebrokerforthestrategyis132contractsshort.

i_MarketPosition_at_Brokerwillreturn'0'ifthecurrentpositionatthebrokerforthestrategyisflat.

i_MarketPosition_at_Brokerwillreturn'0'iftheAutomatedTradingModeisnotturnedon.

789

i_MarketPosition_at_Broker_for_The_StrategyReturnsanumericalvalue,indicatingthenumberofcontractsandthetypeofpositionatthebrokerforthestrategy.

Apositivevalueindicatesalongpositionandanegativevalueindicatesashortposition.

Azero('0')isreturnedwhenthecurrentpositionisflat,orifAutomatedTradingisnotturnedon.

Usage

i_MarketPosition_at_Broker_for_The_Strategy

Notes

Thisfunctioncanonlybeusedinindicators.

Thisfunctiondiffersfromthemarketpositionkeywordinthatitcannottakeanargumenttoreferencepastvalues.Bysavingthevalueofi_MarketPosition_at_Broker_for_The_StrategytoaNumericVariable,it'spossibletoreferencethepositionatthebrokerforpreviousbarsortick.

Important

IfAutomatedTradingwasmanuallyturnedoffbytheuser,thevaluereturnedbythekeywordstopschanging,andmayremainunequalto'0'.

Example

i_MarketPosition_at_Broker_for_The_Strategywillwillreturn'17'ifthecurrentpositionatthebrokerforthestrategyis17contractslong.

i_MarketPosition_at_Broker_for_The_Strategywillreturn'-132'ifthecurrentpositionatthebrokerforthestrategyis132contractsshort.

790

i_MarketPosition_at_Broker_for_The_Strategywillreturn'0'ifthecurrentpositionatthebrokerforthestrategyisflat.

i_MarketPosition_at_Broker_for_The_Strategywillreturn'0'iftheAutomatedTradingModeisnotturnedon.

791

MarketPosition

Returnsanumericalvalue,indicatingthetypeofthespecifiedposition.

Avalueof1indicatesalongposition,-1indicatesashortposition,and0isreturnedonlyifthecurrentpositionisspecifiedandindicatesthatthecurrentpositionisflat.

Usage

MarketPosition(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

MarketPositionwillreturnavalueof0ifthecurrentpositionisflat

MarketPosition(1)willreturnavalueof-1ifthemostrecentlyclosedpositionwasashortposition

792

MarketPosition_at_BrokerReturnsanumericalvalue,indicatingthenumberofcontractsandthetypeofpositionatthebrokerforthesymbol.

Apositivevalueindicatesalongpositionandanegativevalueindicatesashortposition.

Azero('0')isreturnedwhenthecurrentpositionisflat,orifAutomatedTradingisnotturnedon.

Usage

MarketPosition_at_Broker

Notes

Thisfunctioncanonlybeusedinsignalsandfunctions.

Thisfunctiondiffersfromthemarketpositionkeywordinthatitcannottakeanargumenttoreferencepastvalues.

ThisfunctioncanonlybeusedwithInteractiveBrokers,Patsystems,andZen-Fire.

Important

IfAutomatedTradingwasmanuallyturnedoffbytheuser,thevaluereturnedbythekeywordstopschanging,andmayremainunequalto'0'.

Example

MarketPosition_at_Brokerwillwillreturn'17'ifthecurrentpositionatthebrokerforthestrategyis17contractslong.

MarketPosition_at_Brokerwillreturn'-132'ifthecurrentpositionatthebrokerforthestrategyis132contractsshort.

793

MarketPosition_at_Brokerwillreturn'0'ifthecurrentpositionatthebrokerforthestrategyisflat.

MarketPosition_at_Brokerwillreturn'0'iftheAutomatedTradingModeisnotturnedon.

794

MarketPosition_at_Broker_for_The_StrategyReturnsanumericalvalue,indicatingthenumberofcontractsandthetypeofpositionatthebrokerforthestrategy.

Apositivevalueindicatesalongpositionandanegativevalueindicatesashortposition.

Azero('0')isreturnedwhenthecurrentpositionisflat,orifAutomatedTradingisnotturnedon.

Usage

MarketPosition_at_Broker_for_The_Strategy

Notes

Thisfunctioncanonlybeusedinsignalsandfunctions.

Thisfunctiondiffersfromthemarketpositionkeywordinthatitcannottakeanargumenttoreferencepastvalues.

Important

IfAutomatedTradingwasmanuallyturnedoffbytheuser,thevaluereturnedbythekeywordstopschanging,andmayremainunequalto'0'.

Example

MarketPosition_at_Broker_for_The_Strategywillwillreturn'17'ifthecurrentpositionatthebrokerforthestrategyis17contractslong.

MarketPosition_at_Broker_for_The_Strategywillreturn'-132'ifthecurrentpositionatthebrokerforthestrategyis132contractsshort.

MarketPosition_at_Broker_for_The_Strategywillreturn'0'ifthecurrent

795

positionatthebrokerforthestrategyisflat.

MarketPosition_at_Broker_for_The_Strategywillreturn'0'iftheAutomatedTradingModeisnotturnedon.

796

MarketPosition_Checked

Returnsanumericalvalue,indicatingthetypeofthespecifiedposition.

Avalueof1indicatesalongposition,-1indicatesashortposition,and0isreturnedonlyifthecurrentpositionisspecifiedandindicatesthatthecurrentpositionisflat.

Usage

MarketPosition_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,MarketPosition_Checkedwillgenerateanerror.

Example

MarketPosition_Checked-willreturnavalueof0ifthecurrentpositionisflat.

MarketPosition_Checked(1)-willreturnavalueof-1ifthemostrecentlyclosedpositionwasashortposition.

797

MaxContractProfit

Returnsanumericalvalue,indicatingthelargestgainreachedpereachcontractorshareofacurrentmulti-shareormulti-contractposition.

Usage

MaxContractProfit

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Assignavalue,indicatingthelargestgainreachedpercontractorshare,toValue1variable:

Value1=MaxContractProfit;

798

MaxContractProfit_Checked

Returnsanumericalvalue,indicatingthelargestgainreachedpereachcontractorshareofacurrentmulti-shareormulti-contractposition.

Usage

MaxContractProfit_Checked

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,MaxContractProfit_Checkedwillgenerateanerror.

Example

Assignavalue,indicatingthelargestgainreachedpercontractorshare,toValue1variable:

Value1=MaxContractProfit_Checked

799

MaxContracts

Returnsanabsolutenumericalvalue,indicatingthemaximumnumberofcontractsheldduringthespecifiedposition.

Usage

MaxContracts(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

MaxContractswillreturnavalueof0ifthecurrentpositionisflat

MaxContracts(1)willreturnavalueof10ifthemostrecentlyclosedpositionwaslongorshortamaximumof10contracts

800

MaxContracts_Checked

Returnsanabsolutenumericalvalue,indicatingthemaximumnumberofcontractsheldduringthespecifiedposition.

Usage

MaxContracts_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,MaxContracts_Checkedwillgenerateanerror.

Example

MaxContracts_Checked-willreturnavalueof0ifthecurrentpositionisflat.

MaxContracts_Checked(1)-willreturnavalueof10ifthemostrecentlyclosedpositionwaslongorshortamaximumof10contracts.

801

MaxEntries

Returnsanumericalvalue,indicatingthetotalnumberofentriesforthespecifiedposition.

Usage

MaxEntries(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

MaxEntries(1)willreturnavalueof2ifthereweretwoseparateentriesforthemostrecentlyclosedposition

802

MaxEntries_Checked

Returnsanumericalvalue,indicatingthetotalnumberofentriesforthespecifiedposition.

Usage

MaxEntries_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,MaxEntries_Checkedwillgenerateanerror.

Example

MaxEntries_Checked(1)-willreturnavalueof2ifthereweretwoseparateentriesforthemostrecentlyclosedposition.

803

MaxPositionLoss

Returnsanegativenumericalvalue,indicatingthelargestlossreachedwhilethespecifiedpositionwasheld.

Usage

MaxPositionLoss(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

MaxPositionLosswillreturnavalueof0ifthevalueoftheopenpositionhasnotdroppedbelowtheentrypriceatanytimewhileitwasheld

MaxPositionLoss(1)willreturnavalueof-10ifthemostrecentlyclosedpositionhasdroppedinvalueasmuchas¤10whileitwasheld

804

MaxPositionLoss_Checked

Returnsanegativenumericalvalue,indicatingthelargestlossreachedwhilethespecifiedpositionwasheld.

Usage

MaxPositionLoss_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,MaxPositionLoss_Checkedwillgenerateanerror.

Example

MaxPositionLoss_Checked;-willreturnavalueof0ifthevalueoftheopenpositionhasnotdroppedbelowtheentrypriceatanytimewhileitwasheld.

MaxPositionLoss_Checked(1);-willreturnavalueof-10ifthemostrecentlyclosedpositionhasdroppedinvalueasmuchas¤10whileitwasheld.

805

MaxPositionProfit

Returnsanumericalvalue,indicatingthelargestgainreachedwhilethespecifiedpositionwasheld.

Usage

MaxPositionProfit(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

MaxPositionProfitwillreturnavalueof0ifthevalueoftheopenpositionhasnotincreasedatanytimewhileitwasheld

MaxPositionProfit(1)willreturnavalueof10ifthemostrecentlyclosedpositionhasgainedinvalueasmuchas¤10whileitwasheld

806

MaxPositionProfit_Checked

Returnsanumericalvalue,indicatingthelargestgainreachedwhilethespecifiedpositionwasheld.

Usage

MaxPositionProfit_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,MaxPositionProfit_Checkedwillgenerateanerror.

Example

MaxPositionProfit_Checked;-willreturnavalueof0ifthevalueoftheopenpositionhasnotincreasedatanytimewhileitwasheld.

MaxPositionProfit_Checked(1);-willreturnavalueof10ifthemostrecentlyclosedpositionhasgainedinvalueasmuchas¤10whileitwasheld.

807

MaxPositionsAgo

Returnsthenumberofclosedpositionsforthestrategyonthecurrentmoment.

Usage

MaxPositionsAgo

Note

ThisfunctioncanonlybeusedinSignals.

Example

CalculatethePnLforallclosedpositionsuptothecurrentmoment:

var:TotalProfitLoss(0),idx(0);foridx=1toMaxPositionsAgoBeginTotalProfitLoss=PositionProfit(idx);End;

808

MaxSharesSameasMaxContracts

809

MaxShares_CheckedSameasMaxContracts_Checked

810

OpenPositionProfit

Returnsanumericalvalue,indicatingthecurrentunrealizedprofitorlossfortheopenposition.

Usage

OpenPositionProfit

Notes

Thisfunctioncanonlybeusedinsignals.

Example

OpenPositionProfitwillreturnavalueof0ifthecurrentpositionisflat

OpenPositionProfitwillreturnavalueof10ifthevalueoftheopenpositionhasincreasedby¤10sinceitwasentered

OpenPositionProfitwillreturnavalueof-5ifthevalueoftheopenpositionhasdecreasedby¤5sinceitwasentered

811

PositionProfit

Returnsanumericalvalue,indicatingthetotalrealizedprofitorlossforthespecifiedclosedposition.

Usage

PositionProfit(PosBack)

Where:PosBack-anumericalexpression,specifyingtheclosedposition:

1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

Thisfunctioncanonlybeusedinsignals.

Example

PositionProfit(0)willreturnavalueof5ifthevalueoftheopenpositionhasincreasedby¤5sinceitwasentered

PositionProfit(1)willreturnavalueof-5ifthemostrecentlyclosedpositionhasgeneratedalossof¤5

812

PositionProfit_Checked

Returnsanumericalvalue,indicatingtheprofitorlossforthespecifiedposition.

Usage

PositionProfit_Checked(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;1-onepositionback(thelastpositionclosed);2-twopositionsback,etc.

IfPosBackisnotspecified,avaluefortheopenpositionwillbereturned.

Notes

1. Thisfunctioncanonlybeusedinsignals.2. IfPosBackvalueisgreaterthattherealnumberofpreviouslyopened

positions,PositionProfit_Checkedwillgenerateanerror.

Example

PositionProfit_Checked;-willreturnavalueof0ifthecurrentpositionisflat.

PositionProfit_Checked(0);-willreturnavalueof5ifthevalueoftheopenpositionhasincreasedby¤5sinceitwasentered.

PositionProfit_Checked(1);-willreturnavalueof-5ifthemostrecentlyclosedpositionhasgeneratedalossof¤5.

813

ChangeMarketPosition

Placestheorderwithsetnameandpriceonthechart.

Usage

ChangeMarketPosition(Delta,Price,Name)

Where:Delta-numberofcontractsbywhichcurrentmarketpositionshouldbechanged;Price-orderfillingprice;Name-nameoftheorderthatchangestheposition.

Notes

Canbeusedasameanofsynchronizationofstrategymarketpositionwithabroker.

Example

IfMarketPosition=2thenChangeMarketPosition(-2,100,"LX")

Willplacecloseorderwiththename"LX"andtheprice100ifcurrentmarketposition=2

IfMarketPosition=0thenChangeMarketPosition(-2,100,"SE")

Willplaceopenorderwiththename"SE"andtheprice100ifcurrentmarketposition=0

Pleasereferto"!FromStrategyToBrokerMPSynchronizer!"defaultsignalformoreexamples.

814

PlaceMarketOrder

Placesmarketorderatthebrokerwithoutpositionchangingonthechart.

Usage

PlaceMarketOrder(IsBuy,IsEntry,Contracts)

Where:IsBuy-indicateswhetherorderisbuyorsell;IsEntry-indicateswhetherorderisentryorexit;Contracts-indicatesthenumberofcontracts/sharesoftheorder.

Notes

Worksonlywithautotradingturnedon.

Canbeusedasameanofsynchronizationofstrategymarketpositionwithabroker.

Example

IfMarketPosition*CurrentContracts=2andMarketPosition_at_Broker=4thenPlaceMarketOrder(false,false,2);

willgeneratesellmarketorderfor2contractstosynchronizemarketpositionatbrokerwiththestrategyposition

Pleasereferto"!FromStrategyToBrokerMPSynchronizer!"defaultsignalformoreexamples.

815

OpenEntriesCount

SameasCurrentEntries.

816

OpenEntryComission

Returnsanumericalvalue,indicatingtheamountofcashassetsintheunitsoftheselectedcurrencyspentonthecommissionforspecifiedtrade.

Usage

OpenEntryComission(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryComission(1)willreturnavalueof1iftherehasbeenoneunitoftheselectedcurrencycomissionforthesecondtradeoftheopenposition.

817

OpenEntryContracts

Returnsanumericalvalue,indicatingthequantityofcontractsofspecifiedentryorderintotheopenposition.

Usage

OpenEntryContracts(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryContractswillreturnavalueof1forthefirsttradeofthe3contractsopenpositionifithastwoopentradesfor1and2contracts.

OpenEntryContracts(1)willreturnavalueof2forthesecondtradeofthe3contractsopenpositionifithastwoopentradesfor1and2contracts.

818

OpenEntryDate

Returnsanumericalvalue,indicatingthedateofspecifiedentryintotheopenposition.

ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

OpenEntryDate(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryDate(1)willreturn1110402fortheopenpositionifthesecondtradewasgeneratedonApril2nd,2011.

819

OpenEntryMaxProfit

Returnsanumericalvalue,indicatingmaximalvalueofOpenEntryProfitforthetimefromentryorderexecution.

Usage

OpenEntryMaxProfit(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryMaxProfitwillreturnavalueof20forthefirsttradeoftheopenpositionifithaseverreached20unitsofthespecifiedcurrencymaximumprofit.

820

OpenEntryMaxProfitPerContract

Returnsanumericalvalue,indicatingmaximalvalueofOpenEntryProfitPerContractforthetimefromentryorderexecution.

Usage

OpenEntryMaxProfitPerContract(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryMaxProfitPerContract(1)willreturnavalueof1.5forthefirsttradeoftheopenpositionifithaseverreached1.5unitsofthespecifiedcurrencypercontractprofit.

821

OpenEntryMinProfit

Returnsanumericalvalue,indicatingminimalvalueofOpenEntryProfitforthetimefromentryorderexecution.

Usage

OpenEntryMinProfit(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryMinProfit(1)willreturnavalueof-15forthesecondtradeoftheopenpositionifithaseverreached15unitsofthespecifiedcurrencyloss.

822

OpenEntryMinProfitPerContract

Returnsanumericalvalue,indicatingminimalvalueofOpenEntryProfitPerContractforthetimefromentryorderexecution.

Usage

OpenEntryMinProfitPerContract(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryMinProfitPerContract(1)willreturnavalueof-1.5forthesecondtradeoftheopenpositionifithaseverreached1.5unitsofthespecifiedcurrencypercontractloss.

823

OpenEntryPrice

Returnsanumericalvalue,indicatingthepriceofspecifiedentryintotheopenposition.

Usage

OpenEntryPrice(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryPricewillreturnavalueof101forthefirsttradeoftheopenpositionifitwasexecutedat101pricelevel.

OpenEntryPrice(1)willreturnavalueof101.5forthesecondtradeoftheopenpositionifitwasexecutedat101.5pricelevel.

824

OpenEntryProfit

Returnsanumericalvalue,indicatingtheprofit(lossifnegative)ofspecifiedentryintotheopenpositioninthespecifiedcurrency.

Usage

OpenEntryProfit(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryProfitwillreturnavalueof10forthefirsttradeoftheopenpositionifithas10unitsofthespecifiedcurrencyprofitatthemoment.

OpenEntryProfit(1)willreturnavalueof-10forthesecondtradeoftheopenpositionifithasreached10unitsofthespecifiedcurrencylossatthemoment.

825

OpenEntryProfitPerContract

Returnsanumericalvalue,indicatingtheprofit(lossifnegative)percontractofspecifiedentryinthespecifiedcurrency.

Usage

OpenEntryProfitPerContract(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryProfitPerContractwillreturnavalueof1forthefirsttradeoftheopenpositionifithas1unitoftheselectedcurrencypercontractprofitatthemoment.

OpenEntryProfitPerContract(1)willreturnavalueof-0.5forthesecondtradeoftheopenpositionifithasreached0.5unitsoftheselectedcurrencypercontractlossatthemoment.

826

OpenEntryTime

Returnsanumericalvalue,indicatingthetimeofspecifiedentryintotheopenposition.

ThetimeisindicatedintheHHmmformat,whereHHisthehourin24hoursformatandmmareminutes.

Usage

OpenEntryTime(EntryIndex)

Where:EntryIndex-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinopenpositionuseOpenEntriesCount

Example

OpenEntryTimewillreturnavalueof1015forthefirsttradeoftheopenpositionifitwasexecutedat10:15AM.

OpenEntryTime(1)willreturnavalueof1545forthesecondtradeoftheopenpositionifitwasexecutedat3:45PM.

827

PosTradeCommission

Returnsanabsolutenumericalvalue,indicatingthecommissionamountspentforthespecifiedtrade.

Usage

PosTradeCommission(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeCommission(0,1)willreturnavalueof5forthesecondtradeoftheopenposition,ifthecommissionforthistradeis5unitsoftheselectedcurrency.

828

PosTradeCount

Returnsanumericalvalue,indicatingthetotalnumberofentriesforthespecifiedposition.

Usage

PosTradeCount(PosBack)

Where:PosBack-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

Notes

Thisfunctioncanonlybeusedinsignals.Pleasenotethatifthereisasingleentryandmultiplescalpingexits,eachexitwillhaveitsownentryinthiscaseandthecountwillincreaseaftereachpartialexit.

Example

PosTradeCount(1)willreturnavalueof2ifthereweretwoseparateentriesforthemostrecentlyclosedposition.

829

PosTradeEntryBar

Returnsanabsolutenumericalvalue,indicatingbarnumberofthetradeentryorder.

Usage

PosTradeEntryBar(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeEntryBar(0,1)willreturnavalueof25forthesecondtradeoftheopenposition,ifthistradewasopenedon25thbar.

830

PosTradeEntryCategory

Returnsanabsolutenumericalvalue,indicatingtradeentryordercategory.

Thefollowingtypesarepossible:

1=Stoporder(buynextbaratclose-1pointstop)2=Limitorder(buynextbaratclose+1pointlimit)3=Marketorder(buynextbarmarket)4=MarketatCloseorder(buythisbaratclose)5=MarketatOpenorder(buynextbaropen)6=Reservedforspecialorders7=Reservedforspecialorders8=StopLimitorder(buy1contractsnextbaratclose-2pointstopclose+2pointlimit)

Usage

PosTradeEntryCategory(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

831

Example

PosTradeEntryCategory(0,1)willreturnavalueof1forthesecondtradeoftheopenposition,iftheordertypewasStopOrder.

832

PosTradeEntryDateTime

Returnsdouble-precisiondecimalDateTimeforentryorder.AsanexampleseeComputerDateTime

Usage

PosTradeEntryDateTime(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeEntryDateTime(0,1)willreturnavalueof39448.25000000forthesecondtradeoftheopenposition,ifthistradewasopenedat6:00AMonJanuary1st,2008.

833

PosTradeEntryName

Returnsentryordername.EntryNameisindicatedonthechartandinOrderandPositionTrackerWindow.

Usage

PosTradeEntryName(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeEntryName(0,1)willreturnavalueof"buyLE"forthesecondtradeoftheopenposition,ifthistradewasopenedbytheorderwith"buyLE"name.

834

PosTradeEntryPrice

Returnsanabsolutenumericalvalue,indicatingtheexecutionpriceoftradeentryorder.

Usage

PosTradeEntryPrice(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeEntryPrice(0,1)willreturnavalueof100.2forthesecondtradeoftheopenposition,ifthistradewasopenedbytheorderfilledat100.2.

835

PosTradeExitBar

Returnsanabsolutenumericalvalue,indicatingbarnumberofthetradeexitorder.

Usage

PosTradeExitBar(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeExitBar(0,1)willreturnavalueof28forthesecondtradeoftheopenposition,ifthistradewasclosedon28thbar.

836

PosTradeExitCategory

Returnsanabsolutenumericalvalue,indicatingtradeexitordercategory.

Thefollowingtypesarepossible:

1=Stoporder(buynextbaratclose-1pointstop)2=Limitorder(buynextbaratclose+1pointlimit)3=Marketorder(buynextbarmarket)4=MarketatCloseorder(buythisbaratclose)5=MarketatOpenorder(buynextbaropen)6=Reservedforspecialorders7=Reservedforspecialorders8=StopLimitorder(buy1contractsnextbaratclose-2pointstopclose+2pointlimit)

Usage

PosTradeExitCategory(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

837

Example

PosTradeExitCategory(0,1)willreturnavalueof3forthesecondtradeoftheopenposition,iftheclosingordertypewasMarketOrder.

838

PosTradeExitDateTime

Returnsdouble-precisiondecimalDateTimeforexitorder.AsanexampleseeComputerDateTime

Usage

PosTradeExitDateTime(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeEntryDateTime(1,1)willreturnavalueof39448.25000000forthesecondtradeofthelastclosedposition,ifthistradewasclosedat6:00AMonJanuary1st,2008.

839

PosTradeExitName

Returnsexitordername.ExitNameisindicatedonthechartandinOrderandPositionTrackerWindow.

Usage

PosTradeExitName(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeExitName(0,1)willreturnavalueof"sellLX"forthesecondtradeoftheopenposition,ifthistradewasclosedbytheorderwith"sellLX"name.

840

PosTradeExitPrice

Returnsanabsolutenumericalvalue,indicatingtheexecutionpriceoftradeexitorder.

Usage

PosTradeExitPrice(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeExitPrice(0,1)willreturnavaluevalueof100.5forthesecondtradeoftheopenposition,ifthistradewasclosedbytheorderfilledat100.5.

841

PosTradeIsLong

ReturnsTruevalueifthetradewasopenedbybuyorder,otherwiseFalsevalueisreturned.

Usage

PosTradeIsLong(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeIsLong(0,1)willreturnTrueforthesecondtradeoftheopenposition,ifthistradewasopenedby"buy"order.

842

PosTradeIsOpen

ReturnsTruevalueifthetradeisopen,Falsevalueifthetradeisclosed.

Itmakessensetocheckthetradesoftheopenposition.

ForotherpositionsFalseisalwaysreturned.

Usage

PosTradeIsOpen(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeIsOpen(0,1)willreturnTrueforthesecondtradeoftheopenposition,ifthistradeisopened(therewasnoclosingorder).

843

PosTradeProfit

Returnsanabsolutenumericalvalue,indicatingtheprofit(orlossifnegative)ofthespecifiedtrade.

Usage

PosTradeProfit(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeProfit(0,1)willreturnavalueof3forthesecondtradeoftheopenposition,iftheprofitforthistradeis3unitsoftheselectedcurrency.

844

PosTradeSize

Returnsanabsolutenumericalvalue,indicatingthenumberofcontractsorsharesinthespecifiedtrade.

Usage

PosTradeSize(PosAgo,TradeNumber)

Where:PosAgo-anumericalexpression,specifyingtheposition:

0-openposition;

1-onepositionback(thelastpositionclosed);

2-twopositionsback,etc.

TradeNumber-anumericalexpression,specifyingthenumberoftrade(zero-based).

Notes

Thisfunctioncanonlybeusedinsignals.

ToretrievethetotalnumberoftradesinspecifiedpositionusePosTradeCount

Example

PosTradeSize(0,1)willreturnavalueof2forthesecondtradeoftheopenposition,ifthistradehadaquantityof2.

845

CommissionReturnsthecommissioncurrencyvalueenteredintheStrategyPropertieswindow.

Usage

Commission

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Commissionwillreturnavalueof10.00ifthecommissionhasbeensetto¤10

846

GetStrategyNameRetainedforbackwardcompatibility.

847

MarginReturnsavalueinunitsoftheselectedcurrencythatindicatesthemarginvaluepercontract.

Usage

Margin

Notes

Themarginvaluemaynotbereturnedforalltypesofthesecurities.Themarginvalueisreturnedforfuturesandoptions.

Example

Margin

848

SlippageReturnstheslippagecurrencyvalueenteredintheStrategyPropertieswindow.

Usage

Slippage

Notes

Thisfunctioncanonlybeusedinsignals.

Example

Slippagewillreturnavalueof0.25iftheslippagehasbeensetto¤0.25

849

MC_Text_GetActiveReturnsanumericalvalueindicatingthetextIDnumberofthecurrentlyselectedtext;returnsavalueof-1ifnotextiscurrentlyselected.

Usage

MC_Text_GetActive

Example

Assignavalue,indicatingthetextIDnumberofthecurrentlyselectedtext,toValue1variable:Value1=MC_Text_GetActive;

850

Text_Anchor_to_Bars

Anchorsthecorrespondingtextdrawingtothevisiblebarindex;returnsavalueof0iftheoperationwasperformedsuccessfully,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

Text_Anchor_to_Bars(Text_ID,LogicalExpression)

Where:Text_IDisanumericalexpressionspecifyingthetextdrawingIDnumberLogicalExpressionisalogicalvalue;True=addoptionandFalse=removeoption

Notes

TextIDnumberisreturnedbyText_Newwhenthetextdrawingiscreated.

Example

AnchorthetextdrawingwithanIDnumberof3tothevisiblebarindex:

Value1=Text_Anchor_to_Bars(3,True);

851

Text_Delete

RemovesatextobjectwiththespecifiedIDnumberfromachart;returnsavalueof0iftheobjectwassuccessfullyremoved,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_Delete(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

RemovethetextobjectwithanIDnumberof3:

Value1=Text_Delete(3);

852

Text_GetActive

ReturnsanumericalvalueindicatingtheobjectIDnumberofthecurrentlyselectedtextobject;returnsavalueof-1ifnotextobjectsarecurrentlyselected.

Usage

Text_GetActive

Notes

Anobject-specificIDnumberisassignedbyText_Newwhenthetextobjectiscreated.

Example

Assignavalue,indicatingtheobjectIDnumberofthecurrentlyselectedtextobject,toValue1variable:

Value1=Text_GetActive;

853

Text_GetAttribute

ReturnsalogicalvalueindicatingthesettingforanattributeofatextobjectwiththespecifiedIDnumber;returnsavalueofTrueiftheattributeissettoon,andavalueofFalseiftheattributeissettoofforifthespecifiedobjectIDnumberisinvalid.

Thesettingsofthefollowingattributescanbereturned:border,bold,italic,strike-out,andunderline.

Usage

Text_GetAttribute(ObjectID,Attribute)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Attribute-anumericalexpressionspecifyingtheattribute:

0-border1-bold2-italic3-strike-out4-underline

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Assignatrue/falsevalue,indicatingthesettingof"bold"attributeforthetextobjectwithanIDnumberof3,toBoldvariable:

Variable:Bold(False);

854

Bold=Text_GetAttribute(3,1);

855

Text_GetBarNumber

ReturnsanumericalvaluerepresentingthebarnumberofthetextobjectwithaspecifiedID;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetBarNumber(ref);

Parameters:

ref-IDofthetextobject;

Example

GetthenumberofthebarwhereatextobjectwithID=1isplaced:

Text_GetBarNumber(1);

856

Text_GetBGColor

ReturnsanRGBcolornumberoralegacycolorvaluethatcorrespondtothebackgroundcolorofatextobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetBGColor(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

AssignanRGBcolornumber,correspondingtothebackgroundcolorofthetextobjectwithanIDnumberof3,toValue1variable:

Value1=Text_GetBGColor(3);

Assignalegacycolorvalue,correspondingtothebackgroundcolorofthetextobjectwithanIDnumberof3,toValue1variable:

[LegacyColorValue=True];Value1=Text_GetBGColor(3);

857

Text_GetBorder

Returnsalogicalvalue,indicatingwhetheraborderisaddedtoatextobjectwiththespecifiedIDnumber;returnsavalueofTrueiftheborderhasbeenadded,andavalueofFalseiftheborderhasnotbeenaddedorifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetBorder(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Assignatrue/falsevalue,indicatingwhetheraborderisaddedtothetextobjectwithanIDnumberof3,toBordervariable:

Variable:Border(False);Border=Text_GetBorder(3);

858

Text_GetColor

ReturnsanRGBcolornumberoralegacycolorvaluethatcorrespondtothecolorofthetextcontainedinatextobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetColor(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

AssignanRGBcolornumber,correspondingtothecolorofthetextobjectwithanIDnumberof3,toValue1variable:

Value1=Text_GetColor(3);

Assignalegacycolorvalue,correspondingtothecolorofthetextobjectwithanIDnumberof3,toValue1variable:

[LegacyColorValue=True];Value1=Text_GetColor(3);

859

Text_GetDate

Returnsanumericalvalue,indicatingthedateofthebaratwhichatextobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

Text_GetDate(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Assignavalue,indicatingthedateofthebaratwhichatextobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Text_GetDate(3);

860

Text_GetFirst

Returnsanumericalvalue,indicatinganobjectIDnumberoftheoldest(thefirsttobeaddedtothecurrentchart)textobjectofthespecifiedorigin;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetFirst(Origin)

Parameters

Origin-anumericalexpressionspecifyingtheoriginofthetextobject:

1-addedbythecurrentstudy2-addedbyastudyotherthenthecurrentstudy,ordrawnmanuallybytheuser3-addedbyanystudy,ordrawnmanuallybytheuser4-addedbythecurrentstudy,ordrawnmanuallybytheuser5-addedbyastudyotherthenthecurrentstudy6-addedbyanystudy7-addedmanuallybytheuser

Notes

Iftheoldest(thefirstadded)textobjectisdeleted,thenextoldest(thesecondadded)textobjectbecomestheoldest(thefirstadded)textobject.

Example

Assignavalue,indicatinganobjectIDnumberoftheoldesttextobjectaddedtothechartbythecurrentstudy,toValue1variable:

Value1=Text_GetFirst(1);

861

Text_GetFontName

ReturnsastringexpressioncorrespondingtothenameofthefontassignedtoatextobjectwiththespecifiedIDnumber.

Usage

Text_GetFontName(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Text_GetFontName(3)willreturnastringexpressioncorrespondingtothenameofthefontassignedtoatextobjectwiththeIDnumberof3

862

Text_GetHStyle

ReturnsthehorizontalplacementstyleofatextobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetHStyle(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Return

Horizontalplacementstyle:

0-totherightofthespecifiedbar1-totheleftofthespecifiedbar2-centeredonthespecifiedbar

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Assignavalue,indicatingthehorizontalplacementstyleofthetextobjectwithanIDnumberof3,toValue1variable:

Value1=Text_GetHStyle(3);

863

Text_GetLock

Lockedtextdrawingscannotbemovedmanually.KeywordreturnsavalueofTrueforLockeddrawings,andavalueofFalseforothers.

Usage

Text_GetLock(Text_ID)

Where:Text_ID-anumericalexpressionspecifyingthetextdrawingIDnumber

Notes

AtextIDnumberisreturnedbyText_Newwhenthetextdrawingiscreated.

Example

AssignLockpropertyofthetextdrawingwithanIDnumberof3toCondition1variable:

Condition1=Text_GetLock(3);

864

Text_GetNext

ReturnsanIDnumberofthefirstexistingtextobjectaddedsubsequenttoatextobjectwiththespecifiedIDnumber,withbothobjectsofaspecifiedorigin;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetNext(ObjectID,Origin)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Origin-anumericalexpressionspecifyingtheoriginofthetextobjects:

1-addedbythecurrentstudy2-addedbyastudyotherthenthecurrentstudy,ordrawnmanuallybytheuser3-addedbyanystudy,ordrawnmanuallybytheuser4-addedbythecurrentstudy,ordrawnmanuallybytheuser5-addedbyastudyotherthenthecurrentstudy6-addedbyanystudy7-addedmanuallybytheuser

Example

AssignavaluetoValue1variable,indicatinganIDnumberofthefirstexistingtextobjectaddedsubsequenttoatextobjectwiththeIDnumberof3,withbothobjectsaddedbythecurrentstudy:

Value1=Text_GetNext(3,1);

865

Text_GetSize

ReturnsanumericalvalueindicatingthefontsizeassignedtoatextobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetSize(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Assignavalue,indicatingthefontsizeofthetextobjectwithanIDnumberof3,toValue1variable:

Value1=Text_GetSize(3);

866

Text_GetString

ReturnsastringexpressioncorrespondingtothetextcontainedinatextobjectwiththespecifiedIDnumber.

Usage

Text_GetString(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Text_GetString(3)willreturnastringexpressioncorrespondingtothetextcontainedinthetextobjectwithanIDnumberof3

867

Text_GetTime

Returnsanumericalvalue,indicatingthetimeofthebaratwhichatextobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

Text_GetTime(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Assignavalue,indicatingthetimeofthebaratwhichatextobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Text_GetTime(3);

868

Text_GetTime_DT

Returnsadouble-precisiondecimalDateTimevalueindicatingthetimeofthebaratwhichatextobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

ThetimeisindicatedintheDateTimeformat,wheretheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

Text_GetTime_DT(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_New_Dtwhenthetextobjectiscreated.

Example

Assignavalue,indicatingthetimeofthebaratwhichatextobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Text_GetTime_DT(3);

869

Text_GetTime_s

Returnsanumericalvalueindicatingthetime,includingseconds,ofthebaratwhichatextobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM.

Usage

Text_GetTime_s(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_New_swhenthetextobjectiscreated.

Example

Assignavalue,indicatingthetimeofthebaratwhichatextobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Text_GetTime_s(3);

870

Text_GetValue

Returnsthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),atwhichatextobjectwiththespecifiedIDnumberhasbeenplaced;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetValue(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Assignavalue,indicatingthepricevalueatwhichatextobjectwiththeIDnumberof3hasbeenplaced,toValue1variable:

Value1=Text_GetValue(3);

871

Text_GetVStyle

ReturnstheverticalplacementstyleofatextobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_GetVStyle(ObjectID)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Return

Verticalplacementstyle:

0-belowthespecifiedpricevalue1-abovethespecifiedpricevalue2-centeredonthespecifiedpricevalue

Pricevaluerepresentstheverticalpositioncorrespondingtoavalueonthepricescaleofachart.

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Assignavalue,indicatingtheverticalplacementstyleofthetextobjectwithanIDnumberof3,toValue1variable:

Value1=Text_GetVStyle(3);

872

Text_Get_Anchor_to_Bars

Returnsthevalueofthe"anchortobar"optionofthetextdrawingwithaspecifiedID.

Usage

Text_Get_Anchor_to_Bars(Text_ID)

Where:Text_IDisanumericalexpressionspecifyingthetextdrawingIDnumber

Notes

TextIDnumberisreturnedbyText_Newwhenthetextdrawingiscreated.

Example

Assign"anchortobars"optionofthetextdrawingwithanIDnumberof3totheCondition1variable:

Condition1=Text_Get_Anchor_to_Bars(3);

873

Text_Lock

Lockscorrespondingtextdrawingsoitcannotbemovedmanually;returnsavalueof0iftheoperationwasperformedsuccessfully,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

Text_Lock(Text_ID,LogicalExpression)

Where:Text_ID-anumericalexpressionspecifyingthetextdrawingIDnumberLogicalExpression-alogicalvalue;True=AddandFalse=Remove

Notes

AtextIDnumberisreturnedbyText_Newwhenthetextdrawingiscreated.

Example

LockthetextdrawingwithanIDnumberof3:

Value1=Text_Lock(3,True);

UnlockthetextdrawingwithanIDnumberof5:

Value1=Text_Lock(5,False);

874

Text_New

Displaysatextobject,consistingofthespecifiedstringexpressionlocatedatthespecifiedbarandspecifiedpricevalue,onthechartthatthestudyisbasedon;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Text_New(BarDate,BarTime,PriceValue,"Text")

Parameters

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime-anumericalexpressionspecifyingthetimeofthebaratwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Text-thestringexpressiontobedisplayed

Example

Place,onthechartthatthestudyisbasedon,thetext"UpT"atthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Text_New(Date,Time,High,"UpT");

875

Text_New_BN

Displaysatextobjectconsistingofthespecifiedstringexpressionlocatedatthespecifiedbarandspecifiedpricevalueonthechartthatthestudyisbasedon;returnsanobject-specificIDnumberrequiredtomodifytheobject.

Usage

Text_New_BN(BarNumber,PriceValue,"Text")

Parameters

BarNumber-Numericalexpressionspecifyingnumberofthebar(horizontalposition).

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectshouldbeplaced.

Text-thestringexpressiontobedisplayed.

Example

Onthechartthatthestudyisbasedonplacethetext"UpT"atthetopofthebariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Text_New_BN(currentbar,High,"UpT");

876

Text_New_Dt

Displaysatextobject,consistingofthespecifiedstringexpressionlocatedatthespecifiedbarandspecifiedpricevalue,onthechartthatthestudyisbasedon;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Text_New_Dt(Bar_DateTime,PriceValue,"Text")

Parameters

Bar_DateTime-Numericalexpressionspecifyingdateandtimeofthebar(horizontalposition).TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced.

Text-thestringexpressiontobedisplayed

Example

Place,onthechartthatthestudyisbasedon,thetext"UpT"atthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Text_New_Dt(DateTime,High,"UpT");

877

Text_New_s

Displaysatextobject,consistingofthespecifiedstringexpressionlocatedatthespecifiedbarandspecifiedpricevalue,onthechartthatthestudyisbasedon;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Text_New_s(BarDate,BarTime_s,PriceValue,"Text")

Parameters

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime_s-anumericalexpressionspecifyingthetimeofthebar,includingseconds,atwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Text-thestringexpressiontobedisplayed

Example

Place,onthechartthatthestudyisbasedon,thetext"UpT"atthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Text_New_s(Date,Time_s,High,"UpT");

878

Text_New_self

Displaysatextobject,consistingofthespecifiedstringexpressionlocatedatthespecifiedbarandspecifiedpricevalue,ontheSubChartcontainingthestudy;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Text_New_self(BarDate,BarTime,PriceValue,"Text")

Parameters

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime-anumericalexpressionspecifyingthetimeofthebaratwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Text-thestringexpressiontobedisplayed

Example

Place,ontheSubChartcontainingthestudy,thetext"UpT"atthepointsoftheplotwheretheOpenpricehasincreasedincrementallyoverthelastthreebars:

Plot1(Close);IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Text_New_self(Date,Time,High,"UpT");

879

Text_New_Self_BNThesameasText_New_BN.Difference:DisplaysatextontheSubChartcontainingthestudy.

880

Text_New_Self_DT

Displaysatextobject,consistingofthespecifiedstringexpressionlocatedatthespecifiedbarandspecifiedpricevalue,ontheSubChartcontainingthestudy;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Text_New_Self_DT(Bar_DateTime,PriceValue,"Text")

Parameters

Bar_DateTime-Numericalexpressionspecifyingdateandtimeofthebar(horizontalposition).TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced.

Text-thestringexpressiontobedisplayed

Example

Place,onthechartthatthestudyisbasedon,thetext"UpT"atthetopofabariftheOpenpricehasincreasedincrementallyoverthelastthreebars:

IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Text_New_Self_DT(DateTime,High,"UpT");

881

Text_New_self_s

Displaysatextobject,consistingofthespecifiedstringexpressionlocatedatthespecifiedbarandspecifiedpricevalue,ontheSubChartcontainingthestudy;returnsanobject-specificIDnumber,requiredtomodifytheobject.

Usage

Text_New_self_s(BarDate,BarTime_s,PriceValue,"Text")

Parameters

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime_s-anumericalexpressionspecifyingthetimeofthebar,includingseconds,atwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Text-thestringexpressiontobedisplayed

Example

Place,ontheSubChartcontainingthestudy,thetext"UpT"atthepointsoftheplotwheretheOpenpricehasincreasedincrementallyoverthelastthreebars:

Plot1(Close);IfOpen>Open[1]AndOpen[1]>Open[2]ThenValue1=Text_New_self_s(Date,Time_s,High,"UpT");

882

Text_SetAttribute

SetsanattributeofthetextinatextobjectwiththespecifiedIDnumber;returnsavalueof0iftheattributewassuccessfullyset,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Thefollowingtextattributescanbeset:border,bold,italic,strike-out,andunderline.

Usage

Text_SetAttribute(ObjectID,Attribute,LogicalExpression)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

Attribute-anumericalexpressionspecifyingtheattribute:

0-border1-bold2-italic3-strike-out4-underline

LogicalExpression-alogicalvalue;True=onandFalse=off

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Settheattribute"bold"toonforthetextinatextobjectwiththeIDnumberof3:

883

Value1=Text_SetAttribute(3,1,True);

884

Text_SetBarNumber

AssignsthespecifiedbarnumbertothetextobjectwiththespecifiedIDnumber;returnsavalueof0ifthebarnumberwassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetBarNumber(ref,Barnumber)

Parameters:

ref-IDnumberofthetextobject;Barnumber-thenewbarnumberthatistobeassignedtothespecifiedobject.

Example

Assignthenewbarnumbervalueof100tothetextobjectwithID=1:

Text_SetBarNumber(1,100);

885

Text_SetBGColor

AssignsthespecifiedbackgroundcolortoatextobjectwiththespecifiedIDnumber;returnsavalueof0ifthecolorwassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetBGColor(ObjectID,BGColor)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

BGColor-anexpressionspecifyingthebackgroundcolor

ThecolorcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumberoralegacycolorvalue,orbyoneof17basecolorwords.

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

AssignthecolorbluetothebackgroundofatextobjectwiththeIDnumberof3:

Value1=Text_SetBGColor(3,Blue);

AssigntheRGBcolor2138336(Orange)tothebackgroundofatextobjectwiththeIDnumberof3:

Value1=Text_SetBGColor(3,2138336);

Assignthelegacycolor4(Green)tothebackgroundofatextobjectwiththeID

886

numberof3:

[LegacyColorValue=True];Value1=Text_SetBGColor(3,4);

887

Text_SetBorder

AddsorremovesaborderaroundthetextobjectwiththespecifiedIDnumber;returnsavalueof0iftheborderwassuccessfullyset,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Thecoloroftheborderisthesameasthecolorofthetextinthetextobject.

Usage

Text_SetBorder(ObjectID,LogicalExpression)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumberLogicalExpression-alogicalvalue;True=AddandFalse=Remove

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

AddabordertothetextobjectwithanIDnumberof3:

Value1=Text_SetBorder(3,True);

RemoveaborderfromthetextobjectwithanIDnumberof3:

Value1=Text_SetBorder(3,False);

888

Text_SetColor

AssignsthespecifiedcolortothetextofatextobjectwiththespecifiedIDnumber;returnsavalueof0ifthecolorwassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetColor(ObjectID,TextColor)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

TextColor-anexpressionspecifyingthetextcolor

ThecolorcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumberoralegacycolorvalue,orbyoneof17basecolorwords.

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

AssignthecolorbluetothetextofatextobjectwiththeIDnumberof3:

Value1=Text_SetColor(3,Blue);

AssigntheRGBcolor2138336(Orange)tothetextofatextobjectwiththeIDnumberof3:

Value1=Text_SetColor(3,2138336);

Assignthelegacycolor4(Green)tothetextofatextobjectwiththeIDnumberof

889

3:

[LegacyColorValue=True];Value1=Text_SetColor(3,4);

890

Text_SetFontName

AssignsthespecifiedfonttoatextobjectwiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

AnyfontintheFontsfoldercanbeused;thefolderisaccessiblefromtheControlPanelinWindowsXPoperatingsystem.

Usage

Text_SetFontName(ObjectID,"FontName")

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumberFontName-astringexpressionspecifyingthefontname

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

AssignfontVerdanatothetextobjectwiththeIDnumberof3:

Value1=Text_SetFontName(3,"Verdana");

891

Text_SetLocation

ModifiesthelocationofatextobjectwiththespecifiedIDnumber;returnsavalueof0ifthelocationoftheobjectwassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetLocation(ObjectID,BarDate,BarTime,PriceValue)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime-anumericalexpressionspecifyingthetimeofthebaratwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

MovethetextobjectwithanIDnumberof3tothetopofthecurrentbar:

Value1=Text_SetLocation(3,Date,Time,High);

892

893

Text_SetLocation_BN

ModifieslocationofatextobjectwiththespecifiedIDnumber;returnsavalueof0iflocationoftheobjectwassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetLocation_BN(ObjectID,BarNumber,PriceValue)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber.

BarNumber-anumericalexpressionspecifyingthebarnumberatwhichtheobjectistobeplaced.

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectshouldbeplaced.

Notes

Anobject-specificIDnumberisreturnedbyText_New_Dtwhenthetextobjectiscreated.

Example

MovethetextobjectwithanIDnumberof3tothetopofthecurrentbar:

Value1=Text_SetLocation_BN(3,currentbar,High);

894

Text_SetLocation_DT

ModifiesthelocationofatextobjectwiththespecifiedIDnumber;returnsavalueof0ifthelocationoftheobjectwassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetLocation_DT(ObjectID,Bar_DateTime,PriceValue)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber.

Bar_DateTime-anumericalexpressionspecifyingthedateandtimeofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheDateTimeformat,wheretheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.DateTimeisafloatingpointvaluewithhighprecision.Itallowsaccessingmillisecondtimestampsofthebar.

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced.

Notes

Anobject-specificIDnumberisreturnedbyText_New_Dtwhenthetextobjectiscreated.

Example

MovethetextobjectwithanIDnumberof3tothetopofthecurrentbar:

Value1=Text_SetLocation_DT(3,DateTime,High);

895

896

Text_SetLocation_s

ModifiesthelocationofatextobjectwiththespecifiedIDnumber;returnsavalueof0ifthelocationoftheobjectwassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetLocation_s(ObjectID,BarDate,BarTime_s,PriceValue)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

BarDate-anumericalexpressionspecifyingthedateofthebaratwhichtheobjectistobeplaced;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

BarTime_s-anumericalexpressionspecifyingthetimeofthebar,includingseconds,atwhichtheobjectistobeplaced;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

PriceValue-anumericalexpressionspecifyingthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart),wheretheobjectistobeplaced

Notes

Anobject-specificIDnumberisreturnedbyText_New_swhenthetextobjectiscreated.

Example

MovethetextobjectwithanIDnumberof3tothetopofthecurrentbar:

Value1=Text_SetLocation_s(3,Date,Time_s,High);

897

898

Text_SetSize

AssignsthespecifiedfontsizetothetextofatextobjectwiththespecifiedIDnumber;returnsavalueof0ifthefontsizewassuccessfullyassigned,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetSize(ObjectID,FontSize)

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumberFontSize-anumericalexpressionspecifyingthefontsize

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Assignthefontsizeof16tothetextofatextobjectwiththeIDnumberof3:

Value1=Text_SetSize(3,16);

899

Text_SetString

ReplaceswiththespecifiedstringexpressionthetextcontainedinatextobjectwiththespecifiedIDnumber;returnsavalueof0ifthestringexpressionwassuccessfullyreplaced,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetString(ObjectID,"Text")

Where:ObjectID-anumericalexpressionspecifyingtheobjectIDnumberText-thenewstringexpressiontobedisplayedinthetextobject

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

Example

Replacethetext,containedinatextobjectwiththeIDnumberof3,withthestringexpression"NewText":

Value1=Text_SetString(3,"NewText");

900

Text_SetStyle

Setstheplacementstyleofatextobjectrelativetothebarandtothepricevaluespecifiedfortheobject;returnsavalueof0iftheplacementstyleoftheobjectwassuccessfullymodified,andavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

Text_SetStyle(ObjectID,HorizPl,VertPl)

Parameters

ObjectID-anumericalexpressionspecifyingtheobjectIDnumber

HorizPl-anumericalexpressionspecifyingthehorizontalplacementstyleforthetextobject:

0-totherightofthespecifiedbar1-totheleftofthespecifiedbar2-centeredonthespecifiedbar

VertPl-anumericalexpressionspecifyingtheverticalplacementstyleforthetextobject:

0-belowthespecifiedpricevalue1-abovethespecifiedpricevalue2-centeredonthespecifiedpricevalue

Pricevaluerepresentstheverticalpositioncorrespondingtoavalueonthepricescaleofachart.

Notes

Anobject-specificIDnumberisreturnedbyText_Newwhenthetextobjectiscreated.

901

Example

CenterthetextobjectwithanIDnumberof3onthebarandonthepricevalue,specifiedfortheobject:

Value1=Text_SetStyle(3,2,2);

902

DoubleQuote

Displaysthedouble-quote(")characterinastring.

Example

ThisexampledemonstrateshowthewordHelloindoublequotescanbedisplayedonthelastbaraboveHigh:

Variable:ID(-1);IfLastBarOnChartThenID=Text_New(Date,Time,High+1Point,DoubleQuote+"Hello"+DoubleQuote);

903

InStr

Returnsthepositionofaspecifiedstringexpressioninsideanotherspecifiedstringexpression.

Thepositionofthestringbeinglocatedisindicatedbythenumberofcharactersfromtheleftsideofthestringbeingevaluated.

Usage

InStr(String1,String2)

Where:String1-astringtobeevaluatedString2-astringtobelocated

Notes

Incasethesearchreturnsnoresults0isreturned

Incaseifthesoughtwordoccursmorethanonce,thefirstpositionwillbereturned

Searchiscasesensetive

Example

InStr("Fridayistheexpirationday","Friday");

willreturnavalueof1,indicatingthatthestring"Friday"beginsatposition1oftheString"Fridayistheexpirationday"

InStr("Fridayistheexpirationday","Monday");

willreturnavalueof0,indicatingthatthestring"Monday"doesnotexistintheString"Fridayistheexpirationday"

904

LeftStr

Returnsoneormoreleftmostcharactersfromthespecifiedstringexpression.

Usage

LeftStr(String,sSize)

Where:String-astringexpressionfromwhichthecharactersaretobetakensSize-anumericalexpressionspecifyingthenumberofcharacterstobereturned

Example

LeftStr("HelloWorld",5);willreturnastringexpression"Hello"

905

LowerStr

Convertstheuppercaselettersofaspecifiedstringexpressiontoalowercase.

Usage

LowerStr("String")

Where:String-astringexpressiontobeconverted

Example

LowerStr("ReturnonAccount");willreturnastringexpression"returnonaccount"

906

MidStr

Returnsapart,startingfromaspecifiedpositionandofaspecifiedlength,ofaspecifiedstringexpression.

Usage

MidStr("String",Pos,Num)

Where:String-astringexpressionthespecifiedpartistobetakenfromPos-anumericalexpressionspecifyingtheposition,fromtheleftsideofthestring,ofthestartingcharacterofthepartNum-anumericalexpressionspecifyingthelength,incharacters,ofthepart

Example

MidStr("Largestwinningtrade",1,7);willreturnastringexpression"Largest"

907

NewLine

Startsanewlineandreturnscarriage.

Notes

Usethe"+"charactertoaddNewLinetoastringexpression.

Example

FileAppend("c:\testfile.txt","Wecanseeanewbarfor"+NumToStr(Date,0)+NewLine);

908

NumToStr

Returnsaspecifiednumericalexpressionintheformofastringexpression.

Usage

NumToStr(Expression,Dec)

Where:Expression-anumericalexpressiontobeconvertedtoastringexpressionDec-anumericalexpressionspecifyingthenumberofdecimalplacesthereturnedstringexpressionistocontain

Example

NumToStr(1500.5,3);willreturnastringexpression"1500.500"

909

RightStr

Returnsoneormorerightmostcharactersfromthespecifiedstringexpression.

Usage

RightStr(String,sSize)

Where:String-astringexpressionfromwhichthecharactersaretobetakensSize-anumericalexpressionspecifyingthenumberofcharacterstobereturned

Example

RightStr("HelloWorld",5);willreturnastringexpression"World"

910

Spaces

Returnsastringexpressionconsistingofaspecifiednumberofspaces.

Usage

Spaces(Num)

Where:Num-anumericalexpressionspecifyingthenumberofspaces

Example

Theexampleinsertstwoblankspacesbetweentheletters"a"and"b":

Print("a"+Spaces(2)+"b");

911

StrLen

Returnsthelength,incharacters,ofaspecifiedstringexpression.

Usage

StrLen("String")

Where:String-astringexpressiontobeevaluated

Example

StrLen("Drawdown");willreturnavalueof8

912

StrToNum

Convertsaspecifiedstringexpressiontoanumericalvalue.

Usage

StrToNum("String")

Where:String-astringexpressiontobeconverted

Notes

Ifnon-numericcharactersareencounteredtherestoftheexpressionisignored.

Example

StrToNum("2500.70");willreturnavalueof2500.70

913

Text

Returnsthestring,formedupbythetransferredarguments.

Usage

Text(Param1,Param2,...,ParamN);

Where:Param(i)isstringexpression,numericexpressionorTrue/Falsevalue.

Example

Text_new(D,T,C,Text("BarDate/Timeis",Date:0:0,"/",Time:0:0));

914

UpperStr

Convertsthelowercaselettersofaspecifiedstringexpressiontouppercase.

Usage

UpperStr("String")

Where:String-astringexpressiontobeconverted

Example

UpperStr("msft");willreturnastringexpression"MSFT"

915

MC_TL_GetActiveReturnsanumericalvalueindicatingthetrendlineIDnumberofthecurrentlyselectedtrendline;returnsavalueof-1ifnotrendlinesarecurrentlyselected.

Usage

MC_TL_GetActive

Notes

Atrendline-specificIDnumberisassignedbyMC_TL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthetrendlineIDnumberofthecurrentlyselectedtrendline,toValue1variable:

Value1=MC_TL_GetActive;

916

MC_TL_NewThesameasTL_New.

917

MC_TL_New_BNThesameasTL_New_BN.

918

MC_TL_New_DTThesameasTL_New_DT.

919

MC_TL_New_SelfThesameasTL_New_Self.

920

MC_TL_New_Self_BNThesameasTL_New_Self_BN.

921

MC_TL_New_Self_DTThesameasTL_New_Self_DT.

922

TL_Anchor_to_Bars

Anchorsthecorrespondingtrendlinedrawingtothevisiblebarindex;returnsavalueof0iftheoperationwasperformedsuccessfully,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_Anchor_to_Bars(TL_ID,LogicalExpression)

Where:TL_IDisanumericalexpressionspecifyingthetrendlineIDnumberLogicalExpressionisalogicalvalue;True=AddoptionandFalse=Removeoption

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

AnchorthetrendlinewithanIDnumberof3tothevisiblebarindex:

Value1=TL_Anchor_to_Bars(3,True);

923

TL_Delete

RemovesatrendlinewiththespecifiedIDnumberfromachart;returnsavalueof0ifthetrendlinewassuccessfullyremoved,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_Delete(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

RemovethetrendlinewithanIDnumberof3:

Value1=TL_Delete(3);

924

TL_GetActive

ThisreservedwordreturnsanumericvaluerepresentingtheIDofthecurrentlyactivetrendline.

Usage

TL_GetActive

Notes

Whenthereservedwordperformsitsoperationsuccessfully,trendlineIDisreturned.

Whenareservedwordcannotperformitsoperation,itreturnsanerrorcode.

Example

Value1=TL_GetActive;

AssignstheIDofthecurrentlyactivetrendlinetoValue1.

Value1isanynumericvariableorarray.

Trendlinereservedwordshouldbeassignedtoanumericvariableorarrayinordertodeterminewhetherthereservedwordperformeditsoperationsuccessfullyornot.

925

TL_GetAlert

ReturnsthealertstatusforatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetAlert(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Return

Alertstatus:

0-Alertdisabled

1-Breakoutintra-bar

AnalertistriggerediftheHighcrossesoverthetrendlineortheLowcrossesunderthetrendline.Alerttriggeringconditionsareevaluatedintra-bar.

2-Breakoutonclose

AnalertistriggerediftheCloseofthepreviousbarwasbelowthetrendlineandtheCloseofthecurrentbarisabovethetrendline,oriftheCloseofthepreviousbarwasabovethetrendlineandtheCloseofthecurrentbarisbelowthetrendline.AlerttriggeringconditionsareevaluatedatCloseofabar.

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthealertstatusforatrendlinewiththeIDnumberof3,toValue1variable:

926

Value1=TL_GetAlert(3);

927

TL_GetBeginDate

Returnsanumericalvalue,indicatingthedateofthestartingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththeearlierdateandtimeisalwaysconsideredtobethestartingpoint;ifthetrendlineisvertical,thepointwiththelowerpricevalueisconsideredtobethestartingpoint.

ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

TL_GetBeginDate(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthedateofthestartingpointofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetBeginDate(3);

928

TL_GetBeginTime

Returnsanumericalvalue,indicatingthetimeofthestartingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththeearlierdateandtimeisalwaysconsideredtobethestartingpoint;ifthetrendlineisvertical,thepointwiththelowerpricevalueisconsideredtobethestartingpoint.

Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

TL_GetBeginTime(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthetimeofthestartingpointofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetBeginTime(3);

929

TL_GetBeginTime_s

Returnsanumericalvalueindicatingthetime,includingseconds,ofthestartingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththeearlierdateandtimeisalwaysconsideredtobethestartingpoint;ifthetrendlineisvertical,thepointwiththelowerpricevalueisconsideredtobethestartingpoint.

Thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM.

Usage

TL_GetBeginTime_s(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_New_swhenthetrendlineiscreated.

Example

Assignavalue,indicatingthetimeofthestartingpointofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetBeginTime_s(3);

930

TL_GetBeginVal

Returnsthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)ofthestartingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththeearlierdateandtimeisalwaysconsideredtobethestartingpoint;ifthetrendlineisvertical,thepointwiththelowerpricevalueisconsideredtobethestartingpoint.

Usage

TL_GetBeginVal(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthepricevalueofthestartingpointofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetBeginVal(3);

931

TL_GetBegin_BN

ReturnsabarnumbervalueofthestartingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetBegin_BN(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

TL_GetBegin_BN(value1);willreturn5ifTrendLinewithID=Value1startsonfifthbarofpriceseries.

932

TL_GetBegin_Dt

ReturnsaDateTimevalue,indicatingthedateandtimeofthestartingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetBegin_Dt(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_New_Dtwhenthetrendlineiscreated.

Example

TL_GetBegin_Dt(value1);willreturn41422.752623935186ifTrendLinewithID=Value1startsat08:30:00.722on5/28/2013

933

TL_GetColor

ReturnsanRGBcolornumberoralegacycolorvaluethatcorrespondtothecolorofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetColor(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

AssignanRGBcolornumber,correspondingtothecolorofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetColor(3);

Assignalegacycolorvalue,correspondingtothecolorofatrendlinewiththeIDnumberof3,toValue1variable:

[LegacyColorValue=True];Value1=TL_GetColor(3);

934

TL_GetEndDate

Returnsanumericalvalue,indicatingthedateoftheendingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththelaterdateandtimeisalwaysconsideredtobetheendingpoint;ifthetrendlineisvertical,thepointwiththehigherpricevalueisconsideredtobetheendingpoint.

ThedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth.

Usage

TL_GetEndDate(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthedateoftheendingpointofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetEndDate(3);

935

TL_GetEndTime

Returnsanumericalvalue,indicatingthetimeoftheendingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththelaterdateandtimeisalwaysconsideredtobetheendingpoint;ifthetrendlineisvertical,thepointwiththehigherpricevalueisconsideredtobetheendingpoint.

Thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM.

Usage

TL_GetEndTime(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthetimeoftheendingpointofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetEndTime(3);

936

TL_GetEndTime_s

Returnsanumericalvalueindicatingthetime,includingseconds,oftheendingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththelaterdateandtimeisalwaysconsideredtobetheendingpoint;ifthetrendlineisvertical,thepointwiththehigherpricevalueisconsideredtobetheendingpoint.

Thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM.

Usage

TL_GetEndTime_s(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_New_swhenthetrendlineiscreated.

Example

Assignavalue,indicatingthetimeoftheendingpointofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetEndTime_s(3);

937

TL_GetEndVal

Returnsthepricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)oftheendingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththelaterdateandtimeisalwaysconsideredtobetheendingpoint;ifthetrendlineisvertical,thepointwiththehigherpricevalueisconsideredtobetheendingpoint.

Usage

TL_GetEndVal(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthepricevalueoftheendingpointofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetEndVal(3);

938

TL_GetEnd_BN

ReturnsabarnumbervalueoftheendingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetEnd_BN(TL_ID)

Where:TL_ID-numericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

TL_GetEnd_BN(value1);willreturn8ifTrendLinewithID=Value1endsoneighthbarofpriceseries.

939

TL_GetEnd_Dt

ReturnsaDateTimevalue,indicatingthedateandtimeoftheendingpointofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetEnd_Dt(TL_ID)

Where:TL_ID-numericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_New_Dtwhenthetrendlineiscreated.

Example

TL_GetEnd_Dt(value1);willreturn41422.752623935186ifTrendLinewithID=Value1endsat08:30:00.722on5/28/2013

940

TL_GetExtLeft

Returnsalogicalvalue,indicatingwhetherthetrendlinewiththespecifiedIDnumberisextendedtotheleft;returnsavalueofTrueifthetrendlineisextended,andavalueofFalseifthetrendlineisnotextendedorifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetExtLeft(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignatrue/falsevalue,indicatingwhetherthetrendlinewithanIDnumberof3isextendedtotheleft,toExtLvariable:

Variable:ExtL(False);ExtL=TL_GetExtLeft(3);

941

TL_GetExtRight

Returnsalogicalvalue,indicatingwhetherthetrendlinewiththespecifiedIDnumberisextendedtotheright;returnsavalueofTrueifthetrendlineisextended,andavalueofFalseifthetrendlineisnotextendedorifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetExtRight(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignatrue/falsevalue,indicatingwhetherthetrendlinewithanIDnumberof3isextendedtotheright,toExtRvariable:

Variable:ExtR(False);ExtR=TL_GetExtRight(3);

942

TL_GetFirst

Returnsanumericalvalue,indicatingthetrendlineIDnumberoftheoldest(thefirsttobedrawnonthecurrentchart)trendlineofthespecifiedorigin;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetFirst(Origin)

Parameters

Origin-anumericalexpressionspecifyingtheoriginofthetrendline:

1-drawnbythecurrentstudy2-drawnbyastudyotherthenthecurrentstudy,ordrawnmanuallybytheuser3-drawnbyanystudy,ordrawnmanuallybytheuser4-drawnbythecurrentstudy,ordrawnmanuallybytheuser5-drawnbyastudyotherthenthecurrentstudy6-drawnbyanystudy7-drawnmanuallybytheuser

Notes

Iftheoldest(thefirsttobedrawn)trendlineisdeleted,thenextoldest(thesecondtobedrawn)trendlinebecomestheoldest(thefirstdrawn)trendline.

Example

Assignavalue,indicatingthetrendlineIDnumberoftheoldesttrendlinedrawnonthechartbythecurrentstudy,toValue1variable:

Value1=TL_GetFirst(1);

943

TL_GetLock

Lockedtrendlinedrawingscannotbemovedmanually.KeywordreturnsavalueofTrueforlockeddrawings,andavalueofFalseforunlocked.

Usage

TL_GetLock(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

AssignLockpropertyofthetrendlinedrawingwithanIDnumberof3toCondition1variable:

Condition1=TL_GetLock(3);

944

TL_GetNext

ReturnsanIDnumberofthefirstexistingtrendlinedrawnsubsequenttoatrendlinewiththespecifiedIDnumber,withbothtrendlinesofaspecifiedorigin;returnsavalueof-2ifthespecifiedobjectIDnumberisinvalid.

Usage

TL_GetNext(TL_ID,Origin)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Origin-anumericalexpressionspecifyingtheoriginofthetrendlines:

1-drawnbythecurrentstudy2-drawnbyastudyotherthenthecurrentstudy,ordrawnmanuallybytheuser3-drawnbyanystudy,ordrawnmanuallybytheuser4-drawnbythecurrentstudy,ordrawnmanuallybytheuser5-drawnbyastudyotherthenthecurrentstudy6-drawnbyanystudy7-drawnmanuallybytheuser

Example

AssignavaluetoValue1variable,indicatingtheIDnumberofthefirstexistingtrendlinedrawnsubsequenttoatrendlinewiththeIDnumberof3,withbothtrendlinesdrawnbythecurrentstudy:

Value1=TL_GetNext(3,1);

945

TL_GetSize

ReturnsanumericalvalueindicatingthewidthofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetSize(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthewidthofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetSize(3);

946

TL_GetStyle

Returnsanumericalvalue,indicatingthestyleofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_GetStyle(TL_ID)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Return

Trendlinestyles:

1 ToolSolid ______________________2 ToolDashed -------------------3 ToolDotted ............................................4 ToolDashed2 _________________5 ToolDashed3 __________________

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignavalue,indicatingthestyleofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetStyle(3);

947

TL_GetValue

Returnsapricevalue,atthespecifieddateandtime,ofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ifthetrendlinedoesnotextendtothespecifieddateandtime,apricevaluealongthesameslopeasthetrendlinewillbereturned.

Usage

TL_GetValue(TL_ID,Date,Time)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Date-anumericalexpressionspecifyingthedate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

Time-anumericalexpressionspecifyingthetime;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignthepricevalue,at10:00AMonJanuary17th,ofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetValue(3,1080117,1000);

948

TL_GetValue_BN

Returnsapricevalue,atthespecifiedbarnumber,ofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ifthetrendlinedoesnotextendtothespecifiedbar,apricevaluealongthesameslopeasthetrendlinewillbereturned.

Usage

TL_GetValue_BN(TL_ID,Barnumber)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber;

Barnumber-anumericalexpressionspecifyinganumberofabar;

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignthepricevalueatbarnumber100ofatrendlinewiththeIDnumberof3toValue1variable:

Value1=TL_GetValue_BN(3,100);

949

TL_GetValue_Dt

Returnsapricevalue,atthespecifieddateandtime,ofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ifthetrendlinedoesnotextendtothespecifieddateandtime,apricevaluealongthesameslopeasthetrendlinewillbereturned.

Usage

TL_GetValue_Dt(TL_ID,DT)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber.

DT-anumericalexpressionspecifyingthetrendlinestartingpointdateandtime;indicatedintheDateTimeformat.TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

Notes

Atrendline-specificIDnumberisreturnedbyTL_New_Dtwhenthetrendlineiscreated.

Example

TL_GetValue_Dt(value1,41422.752623935186);willreturnthepriceoftrendlinewithID=Value1at08:30:00.882of5/28/2013

950

TL_GetValue_s

Returnsapricevalue,atthespecifieddateandtime,ofatrendlinewiththespecifiedIDnumber;returnsavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ifthetrendlinedoesnotextendtothespecifieddateandtime,apricevaluealongthesameslopeasthetrendlinewillbereturned.

Usage

TL_GetValue_s(TL_ID,Date,Time_s)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

Date-anumericalexpressionspecifyingthedate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

Time_s-anumericalexpressionspecifyingthetime,includingseconds;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

Notes

Atrendline-specificIDnumberisreturnedbyTL_New_swhenthetrendlineiscreated.

Example

Assignthepricevalue,at10:00:00AMonJanuary17th,ofatrendlinewiththeIDnumberof3,toValue1variable:

Value1=TL_GetValue_s(3,1080117,100000);

951

TL_Get_Anchor_to_Bars

Returnsthevalueofthe"anchortobar"optionofthetrendlinedrawingwithaspecifiedID.

Usage

TL_Get_Anchor_to_Bars(TL_ID)

Where:TL_IDisanumericalexpressionspecifyingthetrendlineIDnumber

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignthe"anchortobars"optionofthetrendlinedrawingwithanIDnumberof3totheCondition1variable:

Condition1=TL_Get_Anchor_to_Bars(3);

952

TL_Lock

Lockscorrespondingtrendlinedrawingsoitcannotbemovedmanually;returnsavalueof0iftheoperationwasperformedsuccessfully,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_Lock(TL_ID,LogicalExpression)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumberLogicalExpression-alogicalvalue;True=AddandFalse=Remove

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

LockthetrendlinewithanIDnumberof3:

Value1=TL_Lock(3,True);

UnlockthetrendlinewithanIDnumberof5:

Value1=TL_Lock(5,False);

953

TL_New

Displaysatrendline,withthespecifiedstartingandendingpoints,onthechartthatthestudyisbasedon;returnsatrendline-specificIDnumber,requiredtomodifythetrendline.

Usage

TL_New(sDate,sTime,sPriceValue,eDate,eTime,ePriceValue)

Parameters

sDate-anumericalexpressionspecifyingthetrendlinestartingpointdate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

sTime-anumericalexpressionspecifyingthetrendlinestartingpointtime;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

sPriceValue-anumericalexpressionspecifyingthetrendlinestartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

eDate-anumericalexpressionspecifyingthetrendlineendingpointdate

eTime-anumericalexpressionspecifyingthetrendlineendingpointtime

ePriceValue-anumericalexpressionspecifyingthetrendlineendingpointpricevalue

Example

Displayatrendline,thatbeginsat9:00AMatapricevalueof1381,andendsat3:00PMatapricevalueof1337,onJanuary17th,2008,onthechartthatthestudyisbasedon:

Value1=TL_New(1080117,900,1381,1080117,1500,1337);

954

TL_New_BN

Displaysatrendlinewiththespecifiedstartingandendingpointsonthechartthatthestudyisbasedon;returnsatrendline-specificIDnumberrequiredtomodifythetrendline.

InsteadofseparateDateandTimevaluesorasingleDateTimevalue,barnumberofpriceseriesisused.

Usage

TL_New_BN(b_BarNumber,b_Price,e_BarNumber,e_Price);

Parameters

b_BarNumber-anumericalexpressionspecifyingthetrendlinestartingpointbarnumber.

b_Price-anumericalexpressionspecifyingthetrendlinestartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart).

e_BarNumber-anumericalexpressionspecifyingthetrendlineendingpointbarnumber.

e_Price-anumericalexpressionspecifyingthetrendlineendingpointpricevalue.

Example

Displayatrendlinethatwillconnectclosepriceofthefirstbarofpriceserieswiththecurrentcloseprice.

onceValue2=close;

Value1=TL_New_BN(1,Value2,currentbar,Close);

ifValue1<>Value1[1]thentl_delete(Value1[1]);

955

TL_New_Dt

Displaysatrendline,withthespecifiedstartingandendingpoints,onthechartthatthestudyisbasedon;returnsatrendline-specificIDnumber,requiredtomodifythetrendline.

InsteadofseparateDateandTimevalues,asingleDateTimevalueisused.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

TL_New_Dt(b_DateTime,b_Price,e_DateTime,e_Price);

Parameters

b_DateTime-anumericalexpressionspecifyingthetrendlinestartingpointdateandtime;isindicatedintheDateTimeformat.TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

b_Price-anumericalexpressionspecifyingthetrendlinestartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

e_DateTime-anumericalexpressionspecifyingthetrendlineendingpointtime;thedateisindicatedintheDateTimeformat.

e_Price-anumericalexpressionspecifyingthetrendlineendingpointpricevalue

Example

Displayatrenlinethatwillconnectacloseprice100barsbackwiththecurrentcloseprice.

Value1=TL_New_Dt(DateTime[100],Close[100],DateTime,Close);

ifValue1<>Value1[1]thentl_delete(Value1[1]);

956

TL_New_s

Displaysatrendline,withthespecifiedstartingandendingpoints,onthechartthatthestudyisbasedon;returnsatrendline-specificIDnumber,requiredtomodifythetrendline.

Usage

TL_New_s(sDate,sTime_s,sPriceValue,eDate,eTime_s,ePriceValue)

Parameters

sDate-anumericalexpressionspecifyingthetrendlinestartingpointdate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

sTime_s-anumericalexpressionspecifyingthetrendlinestartingpointtime,includingseconds;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

sPriceValue-anumericalexpressionspecifyingthetrendlinestartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

eDate-anumericalexpressionspecifyingthetrendlineendingpointdate

eTime_s-anumericalexpressionspecifyingthetrendlineendingpointtime,includingseconds

ePriceValue-anumericalexpressionspecifyingthetrendlineendingpointpricevalue

Example

Displayatrendline,thatbeginsat9:00:00AMatapricevalueof1381,andendsat3:00:00PMatapricevalueof1337,onJanuary17th,2008,onthechartthatthestudyisbasedon:

957

Value1=TL_New_s(1080117,90000,1381,1080117,150000,1337);

958

TL_New_self

Displaysatrendline,withthespecifiedstartingandendingpoints,ontheSubChartcontainingthestudy;returnsatrendline-specificIDnumber,requiredtomodifythetrendline.

Usage

TL_New_self(sDate,sTime,sPriceValue,eDate,eTime,ePriceValue)

Parameters

sDate-anumericalexpressionspecifyingthetrendlinestartingpointdate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

sTime-anumericalexpressionspecifyingthetrendlinestartingpointtime;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

sPriceValue-anumericalexpressionspecifyingthetrendlinestartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

eDate-anumericalexpressionspecifyingthetrendlineendingpointdate

eTime-anumericalexpressionspecifyingthetrendlineendingpointtime

ePriceValue-anumericalexpressionspecifyingthetrendlineendingpointpricevalue

Example

Displayatrendline,thatbeginsat9:00AMatapricevalueof1381,andendsat3:00PMatapricevalueof1337,onJanuary17th,2008,ontheSubChartcontainingthestudy:

Value1=TL_New_self(1080117,900,1381,1080117,1500,1337);

959

TL_New_Self_BNThesameasTL_New_BN.Difference:DisplaysatrendlineontheSubChartcontainingthestudy.

960

TL_New_Self_Dt

Displaysatrendline,withthespecifiedstartingandendingpoints,ontheSubChartcontainingthestudy;returnsatrendline-specificIDnumber,requiredtomodifythetrendline.

InsteadofseparateDateandTimevalues,asingleDateTimevalueisused.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

TL_New_Self_Dt(b_DateTime,b_Price,e_DateTime,e_Price);

Parameters

b_DateTime-anumericalexpressionspecifyingthetrendlinestartingpointdateandtime;isindicatedintheDateTimeformat.TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

b_Price-anumericalexpressionspecifyingthetrendlinestartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

e_DateTime-anumericalexpressionspecifyingthetrendlineendingpointtime;thedateisindicatedintheDateTimeformat.

e_Price-anumericalexpressionspecifyingthetrendlineendingpointpricevalue

Example

Displayatrenlinethatwillconnectacloseprice100barsbackwiththecurrentclosepriceontheSubChartcontainingthestudy.

Value1=TL_New_Self_Dt(DateTime[100],Close[100],DateTime,Close);

ifValue1<>Value1[1]thentl_delete(Value1[1]);

961

TL_New_Self_s

Displaysatrendline,withthespecifiedstartingandendingpoints,ontheSubChartcontainingthestudy;returnsatrendline-specificIDnumber,requiredtomodifythetrendline.

Usage

TL_New_s(sDate,sTime_s,sPriceValue,eDate,eTime_s,ePriceValue)

Parameters

sDate-anumericalexpressionspecifyingthetrendlinestartingpointdate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

sTime_s-anumericalexpressionspecifyingthetrendlinestartingpointtime,includingseconds;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

sPriceValue-anumericalexpressionspecifyingthetrendlinestartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

eDate-anumericalexpressionspecifyingthetrendlineendingpointdate

eTime_s-anumericalexpressionspecifyingthetrendlineendingpointtime,includingseconds

ePriceValue-anumericalexpressionspecifyingthetrendlineendingpointpricevalue

Example

Displayatrendline,thatbeginsat9:00:00AMatapricevalueof1381,andendsat3:00:00PMatapricevalueof1337,onJanuary17th,2008,ontheSubChartcontainingthestudy:

962

Value1=TL_New_s(1080117,90000,1381,1080117,150000,1337);

963

TL_SetAlert

SetsthealertstatusforatrendlinewiththespecifiedIDnumber;returnsavalueof0ifalertstatuswassuccessfullymodified,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_SetAlert(TL_ID,AlertStatus)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

AlertStatus-anumericalexpressionspecifyingthealertstatusforthetrendline:

0-Alertdisabled

1-Breakoutintra-bar

AnalertistriggerediftheHighcrossesoverthetrendlineortheLowcrossesunderthetrendline.Alerttriggeringconditionsareevaluatedintra-bar.

2-Breakoutonclose

AnalertistriggerediftheCloseofthepreviousbarwasbelowthetrendlineandtheCloseofthecurrentbarisabovethetrendline,oriftheCloseofthepreviousbarwasabovethetrendlineandtheCloseofthecurrentbarisbelowthetrendline.AlerttriggeringconditionsareevaluatedatCloseofabar.

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

964

Setalertstatusto"Breakoutonclose"foratrendlinewiththeIDnumberof3:

Value1=TL_SetAlert(3,2);

965

TL_SetBegin

ModifiesthestartingpointlocationofatrendlinewiththespecifiedIDnumber;returnsavalueof0ifthestartingpointlocationwassuccessfullymodified,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththeearlierdateandtimeisalwaysconsideredtobethestartingpoint;ifthetrendlineisvertical,thepointwiththelowerpricevalueisconsideredtobethestartingpoint.

Usage

TL_SetBegin(TL_ID,sDate,sTime,sPriceValue)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

sDate-anumericalexpressionspecifyingthenewstartingpointdate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

sTime-anumericalexpressionspecifyingthenewstartingpointtime;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

sPriceValue-anumericalexpressionspecifyingthenewstartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

MovethestartingpointofthetrendlinewithanIDnumberof3to10:00AMonJanuary17thatapricevalueof1365:

966

Value1=TL_SetBegin(3,1080117,1000,1365);

967

TL_SetBegin_BN

ModifiesthestartingpointlocationofatrendlinewiththespecifiedIDnumber;returnsavalueof0ifthestartingpointlocationwassuccessfullymodified,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Betweenthetwoendpointsofatrendline,thepointwiththeearlierdateandtimeisalwaysconsideredtobethestartingpoint;ifthetrendlineisvertical,thepointwiththelowerpricevalueisconsideredtobethestartingpoint.

InsteadofseparateDateandTimevaluesorasingleDateTimevalue,barnumberisused.

Usage

TL_SetBegin_BN(TL_ID,BarNumber,Price);

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber.

BarNumber-anumericalexpressionspecifyingthetrendlinestartingpointbarnumber.

Price-anumericalexpressionspecifyingthetrendlinestartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart).

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

SetthebeginningpointofTrendLinewithID=3toclosepriceofcurrentbar

Value1=TL_SetBegin_BN(3,currentbar[100],Close[100]);

968

TL_SetBegin_DT

ModifiesthestartingpointlocationofatrendlinewiththespecifiedIDnumber;returnsavalueof0ifthestartingpointlocationwassuccessfullymodified,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththeearlierdateandtimeisalwaysconsideredtobethestartingpoint;ifthetrendlineisvertical,thepointwiththelowerpricevalueisconsideredtobethestartingpoint.

InsteadofseparateDateandTimevalues,asingleDateTimevalueisused.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

TL_SetBegin_DT(TL_ID,b_DateTime,b_Price);

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

b_DateTime-anumericalexpressionspecifyingthetrendlinestartingpointdateandtime;isindicatedintheDateTimeformat.TheintegerportionoftheDateTimevalueindicatesthenumberofdaysthathaveelapsedsinceJanuary1st,1900,andthefractionalportionoftheDateTimevalueindicatesthefractionofthedaythathaspassedsincemidnight.

b_Price-anumericalexpressionspecifyingthetrendlinestartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

Notes

Atrendline-specificIDnumberisreturnedbyTL_New_DTwhenthetrendlineiscreated.

Example

969

SetthebeginningpointofTrendLinewithID=value1toopenprice100barsback

TL_SetBegin_DT(value1,DateTime[100],Open[100]);

970

TL_SetBegin_s

ModifiesthestartingpointlocationofatrendlinewiththespecifiedIDnumber;returnsavalueof0ifthestartingpointlocationwassuccessfullymodified,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththeearlierdateandtimeisalwaysconsideredtobethestartingpoint;ifthetrendlineisvertical,thepointwiththelowerpricevalueisconsideredtobethestartingpoint.

Usage

TL_SetBegin_s(TL_ID,sDate,sTime_s,sPriceValue)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

sDate-anumericalexpressionspecifyingthenewstartingpointdate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

sTime_s-anumericalexpressionspecifyingthenewstartingpointtime,includingseconds;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

sPriceValue-anumericalexpressionspecifyingthenewstartingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

Notes

Atrendline-specificIDnumberisreturnedbyTL_New_swhenthetrendlineiscreated.

Example

971

MovethestartingpointofthetrendlinewithanIDnumberof3to10:00:00AMonJanuary17thatapricevalueof1365:

Value1=TL_SetBegin_s(3,1080117,100000,1365);

972

TL_SetColor

AssignsthespecifiedcolortoatrendlinewiththespecifiedIDnumber;returnsavalueof0ifthecolorwassuccessfullyassigned,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_SetColor(TL_ID,TL_Color)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

TL_Color-anexpressionspecifyingthetrendlinecolor

TrendlinecolorcanbespecifiedbyanumericalexpressionrepresentinganRGBcolornumberoralegacycolorvalue,orbyoneof17basecolorwords.

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

AssignthecolorbluetothetrendlinewithanIDnumberof3:

Value1=TL_SetColor(3,Blue);

AssigntheRGBcolor2138336(Orange)tothetrendlinewithanIDnumberof3:

Value1=TL_SetColor(3,2138336);

Assignthelegacycolor4(Green)tothetrendlinewithanIDnumberof3:

[LegacyColorValue=True];Value1=TL_SetColor(3,4);

973

974

TL_SetEnd

ModifiestheendingpointlocationofatrendlinewiththespecifiedIDnumber;returnsavalueof0iftheendingpointlocationwassuccessfullymodified,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththelaterdateandtimeisalwaysconsideredtobetheendingpoint;ifthetrendlineisvertical,thepointwiththehigherpricevalueisconsideredtobetheendingpoint.

Usage

TL_SetEnd(TL_ID,eDate,eTime,ePriceValue)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

eDate-anumericalexpressionspecifyingthenewendingpointdate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

eTime-anumericalexpressionspecifyingthenewendingpointtime;thetimeisindicatedinthe24-hourHHmmformat,where1300=1:00PM

ePriceValue-anumericalexpressionspecifyingthenewendingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

MovetheendingpointofthetrendlinewithanIDnumberof3to14:15PMonJanuary17thatapricevalueof1350:

975

Value1=TL_SetEnd(3,1080117,1415,1350);

976

TL_SetEnd_BN

ModifiestheendingpointlocationofatrendlinewiththespecifiedIDnumber;returnsavalueof0iftheendingpointlocationwassuccessfullymodified,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Betweenthetwoendpointsofatrendline,thepointwiththelaterdateandtimeisalwaysconsideredtobetheendingpoint;ifthetrendlineisvertical,thepointwiththehigherpricevalueisconsideredtobetheendingpoint.

InsteadofseparateDateandTimevaluesorasingleDateTimevalue,barnumberisused.

Usage

TL_SetEnd_BN(TL_ID,BarNumber,Price);

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber.

BarNumber-anumericalexpressionspecifyingthetrendlineendingpointbarnumber.

Price-anumericalexpressionspecifyingthetrendlineendingpointpricevalue.

Example

SettheendingpointofTrendLinewithID=3toclosepriceofthecurrentbar

Value1=TL_SetEnd_BN(3,currentbar,Close);

977

TL_SetEnd_Dt

ModifiestheendingpointlocationofatrendlinewiththespecifiedIDnumber;returnsavalueof0iftheendingpointlocationwassuccessfullymodified,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththelaterdateandtimeisalwaysconsideredtobetheendingpoint;ifthetrendlineisvertical,thepointwiththehigherpricevalueisconsideredtobetheendingpoint.

InsteadofseparateDateandTimevalues,asingleDateTimevalueisused.Itallowsaccessingmillisecondtimestampsofthebar.

Usage

TL_SetEnd_Dt(TL_ID,e_DateTime,e_Price);

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber.

e_DateTime-anumericalexpressionspecifyingthetrendlineendingpointdateandtime;thedateandtimeareindicatedintheDateTimeformat.

e_Price-anumericalexpressionspecifyingthetrendlineendingpointpricevalue.

Example

SettheendingpointofTrendLinewithID=value1toclosepriceofthecurrentbar

TL_SetEnd_Dt(value1,DateTime,Close);

978

TL_SetEnd_s

ModifiestheendingpointlocationofatrendlinewiththespecifiedIDnumber;returnsavalueof0iftheendingpointlocationwassuccessfullymodified,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Ofthetwoendpointsofatrendline,thepointwiththelaterdateandtimeisalwaysconsideredtobetheendingpoint;ifthetrendlineisvertical,thepointwiththehigherpricevalueisconsideredtobetheendingpoint.

Usage

TL_SetEnd_s(TL_ID,eDate,eTime_s,ePriceValue)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

eDate-anumericalexpressionspecifyingthenewendingpointdate;thedateisindicatedintheYYYMMddformat,whereYYYisthenumberofyearssince1900,MMisthemonth,andddisthedayofthemonth

eTime_s-anumericalexpressionspecifyingthenewendingpointtime,includingseconds;thetimeisindicatedinthe24-hourHHmmssformat,where130000=1:00:00PM

ePriceValue-anumericalexpressionspecifyingthenewendingpointpricevalue(verticalposition,correspondingtoavalueonthepricescaleofachart)

Notes

Atrendline-specificIDnumberisreturnedbyTL_New_swhenthetrendlineiscreated.

Example

979

MovetheendingpointofthetrendlinewithanIDnumberof3to14:15:00PMonJanuary17thatapricevalueof1350:

Value1=TL_SetEnd_s(3,1080117,141500,1350);

980

TL_SetExtLeft

Addsorremovesaleft-sideextensionforatrendlinewiththespecifiedIDnumber;returnsavalueof0iftheoperationwasperformedsuccessfully,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_SetExtLeft(TL_ID,LogicalExpression)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumberLogicalExpression-alogicalvalue;True=AddandFalse=Remove

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Addaleft-sideextensiontothetrendlinewithanIDnumberof3:

Value1=TL_SetExtLeft(3,True);

Removealeft-sideextensionfromthetrendlinewithanIDnumberof3:

Value1=TL_SetExtLeft(3,False);

981

TL_SetExtRight

Addsorremovesaright-sideextensionforatrendlinewiththespecifiedIDnumber;returnsavalueof0iftheoperationwasperformedsuccessfully,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_SetExtRight(TL_ID,LogicalExpression)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumberLogicalExpression-alogicalvalue;True=AddandFalse=Remove

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Addaright-sideextensiontothetrendlinewithanIDnumberof3:

Value1=TL_SetExtRight(3,True);

Removearight-sideextensionfromthetrendlinewithanIDnumberof3:

Value1=TL_SetExtRight(3,False);

982

TL_SetSize

AssignsthespecifiedwidthtoatrendlinewiththespecifiedIDnumber;returnsavalueof0ifthelinewidthwassuccessfullyassigned,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_SetSize(TL_ID,LineWidth)

Where:TL_ID-anumericalexpressionspecifyingthetrendlineIDnumberLineWidth-anumericalexpressionspecifyingthetrendlinewidth;trendlinewidthcanrangefrom0to6

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

Assignthewidthof5tothetrendlinewithanIDnumberof3:

Value1=TL_SetSize(3,5);

983

TL_SetStyle

AssignsthespecifiedstyletoatrendlinewiththespecifiedIDnumber;returnsavalueof0ifthetrendlinestylewassuccessfullyassigned,andavalueof-2ifthespecifiedtrendlineIDnumberisinvalid.

Usage

TL_SetStyle(TL_ID,TL_Style)

Parameters

TL_ID-anumericalexpressionspecifyingthetrendlineIDnumber

TL_Style-aTLstyleconstantoranumericalexpressionspecifyingthetrendlinestyleasfollows:

Tool_Solid 1

______________________

Tool_Dashed 2 -------------------Tool_Dotted 3 ............................................Tool_Dashed2 4 _________________Tool_Dashed3 5 __________________

Notes

Atrendline-specificIDnumberisreturnedbyTL_Newwhenthetrendlineiscreated.

Example

SetthestyleofthetrendlinewithanIDnumberof3toToolDashed:

984

Value1=TL_SetStyle(3,2);

SetthestyleofthetrendlinewithanIDnumberof3toToolDashed:

Value1=TL_SetStyle(3,Tool_Dashed);

985

Tool_Dashed

Constant,usedincombinationwithTL_SetStyletodesignatetheToolDashedstyle;canbesubstitutedbyanumericalvalueof2.

Usage

TL_SetStyle(TL_ID,Tool_Dashed)

or:

TL_SetStyle(TL_ID,2)

Example

SetthestyleofthetrendlinewithanIDnumberof3toToolDashed:

Value1=TL_SetStyle(3,2);

SetthestyleofthetrendlinewithanIDnumberof3toToolDashed:

Value1=TL_SetStyle(3,Tool_Dashed);

986

Tool_Dashed2

Constant,usedincombinationwithTL_SetStyletodesignatetheToolDashed2style;canbesubstitutedbyanumericalvalueof4.

Usage

TL_SetStyle(TL_ID,Tool_Dashed2)

or:

TL_SetStyle(TL_ID,4)

Example

SetthestyleofthetrendlinewithanIDnumberof3toToolDashed2:

Value1=TL_SetStyle(3,4);

SetthestyleofthetrendlinewithanIDnumberof3toToolDashed2:

Value1=TL_SetStyle(3,Tool_Dashed2);

987

Tool_Dashed3

Constant,usedincombinationwithTL_SetStyletodesignatetheToolDashed3style;canbesubstitutedbyanumericalvalueof5.

Usage

TL_SetStyle(TL_ID,Tool_Dashed3)

or:

TL_SetStyle(TL_ID,5)

Example

SetthestyleofthetrendlinewithanIDnumberof3toToolDashed3:

Value1=TL_SetStyle(3,5);

SetthestyleofthetrendlinewithanIDnumberof3toToolDashed3:

Value1=TL_SetStyle(3,Tool_Dashed3);

988

Tool_Dotted

Constant,usedincombinationwithTL_SetStyletodesignatetheToolDottedstyle;canbesubstitutedbyanumericalvalueof3.

Usage

TL_SetStyle(TL_ID,Tool_Dotted)

or:

TL_SetStyle(TL_ID,3)

Example

SetthestyleofthetrendlinewithanIDnumberof3toToolDotted:

Value1=TL_SetStyle(3,3);

SetthestyleofthetrendlinewithanIDnumberof3toToolDotted:

Value1=TL_SetStyle(3,Tool_Dotted);

989

Tool_Solid

Constant,usedincombinationwithTL_SetStyletodesignatetheToolSolidstyle;canbesubstitutedbyanumericalvalueof1.

Usage

TL_SetStyle(TL_ID,Tool_Solid)

or:

TL_SetStyle(TL_ID,1)

Example

SetthestyleofthetrendlinewithanIDnumberof3toToolSolid:

Value1=TL_SetStyle(3,1);

SetthestyleofthetrendlinewithanIDnumberof3toToolSolid:

Value1=TL_SetStyle(3,Tool_Solid);

990

top related