The code provided defines a function named 'HisTPSL()' that returns an integer value. It iterates through the order history in reverse order, beginning with the most recent order and proceeding to the oldest. The loop uses a variable 'pos_8', initialized as the total number of orders in history minus one.

Inside the loop, each order is selected using the 'OrderSelect()' function. The code then checks if the selected order's symbol matches the current symbol and if its magic number matches the variable 'magic'.

If both conditions are met, the variable 'count_4' is incremented. The code then examines if 'count_4' is less than 2. If so, it checks the order's profit using the 'OrderProfit()' function. A profit greater than 0.0 sets the variable 'Li_ret_0' to 0, while a profit less than 0.0 sets 'Li_ret_0' to 1.

Finally, if 'count_4' reaches 2, the loop terminates. The function then returns the value of 'Li_ret_0'.

This function effectively analyzes the last two orders matching the specified symbol and magic number, providing insights into the most recent trading results. It returns 0 if the last profitable order was the most recent, 1 if the last losing order was the most recent, and -1 otherwise. The function assumes that the variables 'magic' and 'Symbol()' are defined and accessible within the function's scope.

HisTPSL() Function: Analyzing Order History for Profit Analysis

原文地址: https://www.cveoy.top/t/topic/o334 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录