Is it possible to avoid many "ors" (||) in conditions causing the same action? - page 5

 
borilunad:


And this I don't understand what you mean. Where did you get these numbers from? And if you're interested in short variable names, I prefer short to long. Or what else? Yes, just noticed that you added two brackets before clo and at the end after clo to my formula. That's not necessary at all, it disturbs the calculation. But thank you all the same!

<--- 10,444 = 8,087 > 3,908 is that in what language?


double a;<------------ is a number

(isCloseLastPosByTake() == True && Profit > ProClo / clo - GetProfitCloseLastPosByTake() * clo); <-------- this is a member comparison

a = (isCloseLastPosByTake() == True && Profit > ProClo / clo - GetProfitCloseLastPosByTake() * clo)

number = number > number how do you understand this?

 
pako:


double a;<------------ this number

(isCloseLastPosByTake() == True && Profit > ProClo / clo - GetProfitCloseLastPosByTake() * clo); <-------- this is a member comparison

a = (isCloseLastPosByTake() == True && Profit > ProClo / clo - GetProfitCloseLastPosByTake() * clo)

number = number > clo

And I've already done with the bool as you advised me:

bool a = false;

if(isCloseLastPosByTake() == True && Profit > ProClo / clo - GetProfitCloseLastPosByTake() * clo) a = true;


//Кстати, isCloseLastPosByTake() это член, а GetProfitCloseLastPosByTake() это число

And it works, as I've already told you on the previous page! Thank you!
 
borilunad:
As I understand you have variant to fulfill all conditions, while in my case only one condition is enough, and even if more conditions are satisfied, which is unlikely, since they are very different, it won't come to that, because one condition will trigger. If I've got it wrong, justify it! I'm always happy to hear something new! Thanks!

No, you don't.

If any condition (A, B, C, D) = true, Request will be true.

If all =false, Request will be false.

 
icas:

No, you don't.

If any condition (A, B, C, D) = true, Request will be true.

If all =false, Request will be false.

I will try this one too! If it gives positive result in speed, I will choose yours. Thank you!

I tried it, the Request() function put outside the start, but the compiler gives me a warning:

'Request' - no dll defined for the imported function C:\Program Files\

That's all, it works now, but I think the variant from Rako is better, because I don't need to enter additional function Request(). Thanks!

 
Request() return() meant
 
pako:
Request() return() meant
Thanks, but I tried icas's variant and my mistake by putting ; after Request(), now it works, but I think your variant is better, as I told you earlier. Thanks!
 
borilunad:
Thanks, but that was me trying icas's variant and my mistake, putting ; after Request(), now works, but I think your variant is better, as I told you earlier. Thanks!

In the variant

 if((A + B + C + D + E) > 0) Action;

you must always define all conditions A, B, C, D, E.

In my variant this is only done when all conditions are false.

Think now about the speed.

 
icas:

In the variant

you must always define all conditions A, B, C, D, E.

In my variant this is only done when all conditions are false.

Think about the speed now.

Thank you! And how's that? I have these conditions prescribed in the start, after which I call your Request(). Where and how to do I don't understand. :(

Keep in mind that all conditions are mutually exclusive, and will always be all false or only one true and the rest false.

 

icas!

I really hope I've somehow done something wrong, as checking your option didn't reduce the run time in the tester!

Maybe you can explain to me what to put what and where! Thanks!!!

 

borilunad, any function calls add unnecessary braking. So if you want maximum speed, you should get rid of all the Request() functions that perform one-syllable operations. The same applies to loops. Checking the conditions in a loop is always much slower than just a series of nested if()

Reason: