[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 586

 
rigonich:

Well, then I don't know. You need to look through the code, not only of the function, but of the whole program, check for errors along the way, print variable values and the last error and look for a specific error location in the code. When I debugged my own programs, if they were rather large (about 1000 lines) it sometimes took me weeks, i.e. more time than writing them.


there's nothing wrong there, when there were no such functions, everything worked like clockwork! and it works now, but the error on modification occurs in the function itself

I have an idea, maybe this error appears because the modification function is located in the user function, not in the body of start()?

 
Pacman:



Says not to build a ray for an object named His_Name.
 
lottamer:

Here's what I've already written:

-------------------------------------------

int start()

{

purchase condition,

the purchase itself,

and modification

return(0);

}

-----------------------------------------

The problem is that now I need to enter NEW conditions, close conditions, and then close itself, and my EA starts modifying infinitely (stop and take are fixed, but the message about successful modification pops up with every tick).

How can I now create a loop inside this start for new conditions and closing, so that the first part of the EA will not be affected until it closes completely?


Please post the code so we can figure it out and help you out!

 
Ekburg:


everything is fine there, when these functions were not there, everything worked like clockwork! and now it works, but the error during modification occurs in the function itself

i have an idea, maybe this error occurs because the modification function is in the user function, not in the body start()?


It makes no difference. It is important that the function description is outside of other functions, and you can call it from anywhere.
 
rigonich:

It says not to build a ray for an object named His_Name.

I apologise for being meticulous, I just want to understand why the author added these lines to the code.

Basically, we build two lines thick (candlestick body), thin (shadows), change colour and text, but why did they add a beam there.

It's almost 1am locally, so maybe I'm starting to slow down.

 
Pacman:

I apologise for being meticulous, I just want to understand why the author added these lines to the code.

Basically, we build two lines thick (candlestick body), thin (shadows), change colour and text, but why did they add a beam there.

It's almost 1am locally, so maybe I'm starting to slow down.


Because there is no object like a candle, and you can only create objects that are in the terminal, and they all have their own sets of properties.
 
Pacman:

I apologise for being meticulous, I just want to understand why the author added these lines to the code.

Basically, we build two lines thick (candlestick body), thin (shadows), change colour and text, but why did they add a beam there.

It's almost 1am locally, so maybe I'm starting to slow down.

Everything you draw on a graphic (chart) is an object (graphic). Objects have properties. A candlestick is drawn on a chart by an object called trend line(OBJ_TREND). It is defined by 2 points on a chart. It can be set as a segment or as a ray - this is defined by your mentioned property OBJPROP_RAY.
 
Pacman:


Post the code so I can figure it out and help you out!


on the contrary, i wanted to simplify your task and hide the blocks which already work and don't need to be analysed or corrected.

i.e. CONDITIONS, OPENING AND MODIFICATION are already stacked inside the start function.

the next conditions should be inside the same function? I just haven't even written these conditions yet, because I don't know where to put them...

 
lottamer:


on the contrary, i wanted to simplify your task and hide the blocks which are already working and don't need to be analysed or corrected.

i.e. CONDITIONS, OPENING AND MODIFICATION are already stacked inside the start function.

the next conditions should be inside the same function? I just haven't even written these conditions yet, because I don't know where to put them...

Leave the keyboard alone - read and study, you can do that too, and then take a pencil and draw a scheme of your EA, when you draw it - go back to the keyboard. :)))
 
lottamer:

Here's what I've already written:

-------------------------------------------

int start()

{

purchase condition,

the purchase itself,

and modification

return(0);

}

-----------------------------------------

The problem is, now I need to enter NEW conditions, close conditions, and then close itself, and my EA starts modifying infinitely (stop and take are fixed, but successful modification message pops up with every tick).

Can you tell me how to create a loop inside this start for new conditions and closing, so the first part of the EA will not be affected until it closes completely?

If you have fixed sl and tp, why do you need any other conditions for closing? Your trailing stop behaves the same way as standard one from terminal - it modifies order on every tick, if price goes in required direction (it pulls up stoploss). If you want it to modify not on every tick, add condition - do not modify if difference between stoploss of order and current price is less than defined level(trailing stop level + modification step).

As for placement - operators are executed in order, from top to bottom from left to right if there are no branching operators between them (if else)/.

Reason: