Buy pending order problem - page 2

 
Scalper8 #:

It's not ChatGPT Dominik I've been coding since last year MQL4 & MQL5. The code I posted is MQL5 you can check on the first post.

Lets for a moment assume, benefit for the doubt.

Please fix the usage of iMA, make it true mql5 code, and come back to ask for help as you have fixed that.


 
Scalper8 #:

iMA is moving average indicator, symbol means it can run on any pair you drop it on e.g. FX, Indices, Commodities & stocks etc. The 0 (current period) is the indication of the timeframe, Period Indicator is a period of the indicator which 7, the next 0 is MA shift, the next one is the mode of the MA there's 4 of them I choose the LWMA for my strategy, the last one is MA price calculations which is  price close. 

Why is so hard to believe when you can see that its not ChatGPT. 

Because that doesn't work this way. This code is just not working in MQL5.

 
Dominik Egert #:
Could you please tell me what hint I should take to make out it's mql5 code?

I see multiple mql4 indications, but not one clear mql5 indication.

And the formatting of the code is quite typical for chatGPT, btw. The only I know who has blank lines between variable declarations, and else is formated like with a styler....

So to me it looks very much like chatGPT.

Anyways, if you are coding mql4 and mql5 as well, then you should know what warnings the code has given you, and why.

I would like to ask you to fix these, come back and show your fixed code. Then we can talk about problems you are having with it.

I'll post the full mq5 & ex5

Files:
test_sell.ex5  28 kb
test_sell.mq5  5 kb
 
Alain Verleyen #:

Because that doesn't work this way. This code is just not working in MQL5.

is it C Class then for MA??

 
amando #:
 Ot complete ChatGPT, he changed the magic number

WHAAAAT NOOO!!!!!!! this is my code 🤦‍♂️

 
Scalper8 #:

is it C Class then for MA??

Look at the MQL5 documentation about iMA please.
 
Scalper8 #:

WHAAAAT NOOO!!!!!!! this is my code 🤦‍♂️

Now, let's calm down...

You are biting off more than you can chew. Take it step by step.

First of all, you stop using chatGPT, it's going to hurt you, because you will not be able to learn, if you use it.

This aside, the EA you are trying to code here is so simple, in fact the Example EAs delivered with MQL are more advanced.

Why don't you try starting where you have something working and modify it to your requirements.

This approach is much easier for all of us. And it will hand you the chance to actually learn more coding, which, honestly, is very required.

We cannot even speak with each other, because you don't understand the absolute basics...

So, if you truly want to get somewhere, you have to change your attitude towards us, because we like to help people, but they need to put in the effort.

And the effort required by you right now is, you need to learn the basics. Else we cannot help you....

Do you comprehend what I am trying to convey?
 
amando #:
 Ot complete ChatGPT, he changed the magic number
And he used a styler... It's not exactly chatGPT formatting.

But aside from that, other posted code from him is similar, so it could be actually his code....

Just kidding. - It doesn't matter, if he puts in the work required to learn, he will receive help.

It's not his fault, we hate chatGPT code... But it's obviously a problem.
 
Dominik Egert #:
Now, let's calm down...

You are biting off more than you can chew. Take it step by step.

First of all, you stop using chatGPT, it's going to hurt you, because you will not be able to learn, if you use it.

This aside, the EA you are trying to code here is so simple, in fact the Example EAs delivered with MQL are more advanced.

Why don't you try starting where you have something working and modify it to your requirements.

This approach is much easier for all of us. And it will hand you the chance to actually learn more coding, which, honestly, is very required.

We cannot even speak with each other, because you don't understand the absolute basics...

So, if you truly want to get somewhere, you have to change your attitude towards us, because we like to help people, but they need to put in the effort.

And the effort required by you right now is, you need to learn the basics. Else we cannot help you....

Do you comprehend what I am trying to convey?

I've never used ChatGPT because you'll never learn on how to code your own EA's, hence I posted my own code on the forum I knew people of experience would assist me & it wouldn't make sense to waste your time if I'm not coding my own EA's. Now since you mentioned the documentation on the iMA, is this the correct way of doing coding the MA in MQL5: 

if(type==Call_iMA) 
      handle=iMA(name,period,ma_period,ma_shift,ma_method,applied_price); 
   else 
     { 
      //--- fill the structure with parameters of the indicator 
      MqlParam pars[4]; 
      //--- period 
      pars[0].type=TYPE_INT; 
      pars[0].integer_value=ma_period; 
      //--- shift 
      pars[1].type=TYPE_INT; 
      pars[1].integer_value=ma_shift; 
      //--- type of smoothing 
      pars[2].type=TYPE_INT; 
      pars[2].integer_value=ma_method; 
      //--- type of price 
      pars[3].type=TYPE_INT; 
      pars[3].integer_value=applied_price; 
      handle=IndicatorCreate(name,period,IND_MA,4,pars); 

Is this how its suppose to be done? I'll give it a try, just want make sure I'm doing it right.

 
Scalper8 #:

I've never used ChatGPT because you'll never learn on how to code your own EA's, hence I posted my own code on the forum I knew people of experience would assist me & it wouldn't make sense to waste your time if I'm not coding my own EA's. Now since you mentioned the documentation on the iMA, is this the correct way of doing coding the MA in MQL5: 

Is this how its suppose to be done? I'll give it a try, just want make sure I'm doing it right.

Sort of...

The usage of iMA is correct, and gives you a handle. You should create this in OnInit() and use it later with CopyBuffer ()


Your IndicatorCreate will create a second instance, one that is actually displayed on the chart, but has nothing to do with iMA, they are both different instances of the same indicator.