Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 10:53:00 +0000



[Programming Help] - sc.BaseData[SC_ASK_PRICE] instead of sc.BaseData[SC_LAST]?

View Count: 565

[2020-05-26 15:31:40]
clspxes1 - Posts: 4
ACSIL is powerful.

Just have a quick question that I will pose through a scenario.

In the example we have

if (sc.CrossOver(sc.Close, SimpMovAvg) == CROSS_FROM_BOTTOM)

What if someone wanted the Bid Price rather than the closing price of a bar?

i.e.

I've tried:

float BidPrice = sc.BaseData[SC_BID_PRICE][sc.Index]

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

float BidPrice = sc.BaseData[SC_BID_PRICE][0]

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

float BidPrice;  
BidPrice = sc.SymbolData->BidDOM[0].Price; (this is from a user contributed study example (did not work either))


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

EDIT: Of course, followed by placing the bid/BidPrice into the if statement; sc.Crossover(BidPrice, SimpMovAvg)

EDIT2: The title of the thread says SC_ASK_PRICE but I meant SC_BID_PRICE

So, in short, I'm looking to change the logic from:
if (sc.CrossOver(sc.Close, SimpMovAvg) == CROSS_FROM_BOTTOM)
to
if (sc.CrossOver(BidPrice, SimpMovAvg) == CROSS_FROM_BOTTOM)




If you could explain it I'd really appreciate it. If you'd like me to pay for phone support instead just let me know.
Date Time Of Last Edit: 2020-05-26 15:40:58
[2020-05-27 05:56:29]
Flipper - Posts: 65
Are you sure you have bid prices and you have sc.MaintainAdditionalChartDataArrays to 1 in the sc.SetDefaults code block?

sc.BaseData[SC_ASK_PRICE]: This array contains the ask prices at the time of the last trade for each bar. By default, the Bid and Ask prices are only recorded when there is a trade.

When using this array in a study function, it is necessary to set sc.MaintainAdditionalChartDataArrays to 1 in the sc.SetDefaults code block.

For there to be Ask prices in this array, Sierra Chart must be set to a Tick by tick Data Configuration, the Intraday data file for the chart must contain tick by tick data, and contain a Bid and Ask prices. This is not supported with all Data and Trading services.

Because this should work if the above bolded part is true.
if (sc.CrossOver(sc.BaseData[SC_BID_PRICE], SimpMovAvg) == CROSS_FROM_BOTTOM)

ACSIL Interface Members - Variables and Arrays: sc.BaseDataIn[][] / sc.BaseData[][]

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account