Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 15:21:39 +0000



Post From: Passing a sierra chart function to another function

[2024-03-03 16:43:59]
User431178 - Posts: 541
Ignoring the fact that what you are doing seems convoluted, your function pointer syntax is wrong.
BuyEntry and GetLowest are not free functions, but members of s_sc class/struct, therefore the function pointers need to reflect that.


double (*OrderAction)(s_SCNewOrder &)

becomes


double (s_sc::*OrderAction)(s_SCNewOrder &)

then when you call the function you would use


&s_sc::BuyEntry

then within your actual function, you would end up with something like


auto result = (&sc->*OrderAction)(order);

As you are already passing in the sc structure reference, all of the above seems quite unnecessary and can be easily avoided.
Simply pass in an enum or id value to determine the action to take, then call the functions via the sc structure depending on which constant you have passed in.
Date Time Of Last Edit: 2024-03-03 16:45:08