[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 256

 
silhouette:

Vinin, drknn thanks for the replies. I assumed as much, I've just never used such a construction myself and wasn't sure I understood it correctly.

PS The code is not mine, of course. It's a snippet from Awesome custom indicator that comes standard with the program.

 
FAQ:

Vadim, no one doubts your awesomeness, I meant that all this can be done with simpler API tools, which is what the questioner started with, but instead of explaining and helping, you took the conversation to your own topic as usual. And the consequences are soon to follow.

As for me - everything switches, works, always, and as it should:

The coolest - Dima :-))

Well, I have everything done by the simplest means of WinAPI. Haven't you noticed? I showed you all my variants.

What are the consequences? That I do not know how to write in MQL4? I haven't written in it for a long time. I've forgotten the peculiarities.

You've got it all wrong.

 
Switches, right. First it switches and then it indicates. so there is a delay.
 
What cannot be written in Assembler can be re-soldered.
 
The soldering iron, too, is somewhere, somewhere, around the assembler ;)))
 
What a topic for discussion for you newbies, though :) Assemblers, api, basic computer stuff :)
 

Here I am, a newbie again, for the umpteenth time...

Can you give me a hint?

I am making up my EA. I start by making an indicator that would draw arrows where I would place trades.

It draws arrows, but not really there... Here's how I do it:

#property indicator_color1 LimeGreen

#property indicator_color2 Red

....................

double ExtMapBuffer1[];

double ExtMapBuffer2[];

.................

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,225);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexEmptyValue(0,0.0);

SetIndexStyle(1,DRAW_ARROW);

SetIndexArrow(1,226);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexEmptyValue(0,0.0); //by my here error

............................

int limit1;

if(counted_bars>0) counted_bars--;

limit1=Bars-counted_bars;

for(int j=0; j<limit1; j++)

..........................

If(my conditions for purchase)

ExtMapBuffer1[j+1]=High[j+1] // green arrow above the last closed bar - buy

else ExtMapBuffer1[j+1]=0.0; //nothing is drawn

If(my conditions to sell)

ExtMapBuffer2[j+1]=Low[j+1] // red arrow down below the last closed bar - sell

else ExtMapBuffer2[j+1]=0.0; // nothing is drawn

I look at the last bar close in relation to other lines and want to get an arrow above the last closed bar (not the current one), so if I keep an open chart for example 5 min, I get arrows drawn continuously until my conditions are met and remain open.

It seems to me that I messed up something with j and j+1. I also don't understand why the arrows are redrawn. What in this program makes them redraw?

Can you please tell me if it's not too difficult. Thank you.

 
sashaz:

Here I am, a newbie again, for the umpteenth time...

Can you give me a hint?

......................

I look at the closing of the last bar in relation to other lines and I want to get an arrow above the last closed bar (not the current one), so if I keep an open chart for example 5 min, I will have arrows drawn continuously until my conditions are fulfilled and will stay until the chart is open.

It seems to me that I messed up something with j and j+1. I also don't understand why the arrows are redrawn. What in this program makes them redraw?

Can you please tell me if it's not too difficult. Thank you.


The code is very bad. The initialisation and deinitialisation blocks and the indicator start function are missing.
 
drknn:

The code is very bad. The initialisation and deinitialisation blocks and the indicator start function are missing.
I just removed them and left the part where I think the problem is.
 
Better if you show the full code, and paste it using the "SRC" button