LogProfit
Records and prints the profit/loss value, and plots the equity curve based on the profit/loss value.
LogProfit(profit)
LogProfit(profit, ...args)Examples
When calling the LogProfit function, if the last parameter is the character &, the log will not be written to the database and only the profit chart will be updated. Using the & parameter can avoid generating a large number of logs from frequent profit records, thereby keeping the logs clean. For example:
javascript
function main() {
// Plot 30 points on the profit chart
for(var i = 0; i < 30; i++) {
LogProfit(i, '&')
Sleep(500)
}
}
python
def main():
for i in range(30):
LogProfit(i, '&')
Sleep(500)
rust
fn main() {
// Plot 30 points on the profit chart
// In Rust, LogProfit only accepts the profit value parameter and does not support extended parameters such as '&'
for i in 0..30 {
LogProfit(i);
Sleep(500);
}
}
c++
void main() {
for(int i = 0; i < 30; i++) {
LogProfit(i, '&');
Sleep(500);
}
}Arguments
| Name | Type | Required | Description |
profit | number | Yes | The parameter |
arg | string / number / bool / object / array / any (any type supported by the platform) | No | Extended parameter, used to output additional information to this profit log. Multiple |
See Also