Ask
Returns the current ask price.
Syntax
Ask(): number
Return Value
Returns a number
representing the current ask price.
Description
The Ask
method returns the current ask price for the symbol. The ask price is the price at which the market is willing to sell the base currency (in forex) or the asset (in other markets).
Example
// Get current ask price
const currentAsk = this.api.Ask();
console.log(`Current ask price: ${currentAsk}`);
// Calculate spread in points
const spreadInPoints = (this.api.Ask() - this.api.Bid()) / this.api.Point();
console.log(`Current spread in points: ${spreadInPoints}`);
// Use in trading decisions
if (this.api.Ask() < resistanceLevel) {
// Price is below resistance
// Consider long position
}
Last updated