expert advisor - miscellaneous questions - page 38

 
Keith Watford:
that way if you select the line when clicking the button, it will automatically be de-selected.
hmm... It's good idea - thanks for it. I never mind it. Let's I will try it.
 

#Object Mixed - Closed

Thanks a lot for both of yours comments.
So far it works without any issue.

 

#Stop Loss and Take Profit not Correct - Open

Sometimes Stop Loss and Take Profit slightly slide when I open position ( ex: ± 0.00001 or 0.00002 and more for EURUSD while low volatility ).
I need to write a code for it but before I need to ask.

In this cases I currently modify manually after SL and TP slides, and that is really annoying things for me.

Q:  What would be your advice for about this issue, please?

( I am just worrying about code for it that it will bring more issues... )
( And I think it won't be small part of script. )

Thanks in advance.

 

The advice is to use stealth stops.

So stops that are hidden from the broker server.

It means you have to either detect new orders and then place virtual stops, or place virtual stops when the order gets opened.

In both examples you have virtual stops and your EA has to be online to modify and close the stops/position.

If you send your stops to the broker server then it will be the way around you can switch off your EA and the stops will still be triggered because now they are handled by the server and not so much your ea.


So it all depends on what you want to do.

You say you adjust your stops manually, this can be done with both examples.

I am not sure what your question is or what is your preferred TP/SL mechanism.

 

#Stop Loss and Take Profit not Correct - PreClose

Marco vd Heijden:

I got you! While I was reading your comment, I got idea that how I can solve my issue and also I think I will lose a lot time for it.
If I decided to try something for my idea I will make a screenshot for that helps to clarify my issue.

Thank you!

 

#CHARTEVENT_KEYDOWN - Open

I am trying to find alphabet for CHARTEVENT_KEYDOWN function, I already found few things, but they can't solve my issue, maybe they are so old for MQL4.

I already know below example - but I need to get more information or documentation for Alphabet ex: A, B, C, ... Z

#define KEY_LEFT  37 // Left Arrow - works
#define KEY_A     65 // A alphabet - does not works

Q:  Can you share me alphabet key numbers with me, please?

I need to try something for CHARTEVENT_KEYDOWN function today, please help me.
( currently I am researching )

Thanks in advance.

  Solved  
 

I need " A " key could create objects and also cloud delete objects.

example: 1st time Pressed :   " A " key creates few objects. ( which one I already wrote code for it - it works perfect for me )
                2nd time Pressed:   " A " key delete that objects. ( which one " A " key created that objects )

I am just looking method that how can I delete objects with " A " key.
Please give me advice or help me with example.

Thanks in advance.

// 2nd time edited

Last night my Brain was full, now I  Solved  this issue.

#CHARTEVENT_KEYDOWN - Closed
 

#Bitmap Alpha - Open

I need to use .bmp alpha, but I can't get anything good in SEO that I try something. I need good comments, please.

Thanks in advance.

// 2nd time edited

Any related links would be better...
Still researching...

 

#Move Object - ReOpen

Below method ( almost ) works for me for now. ( not tested widely yet, still researching )

Q  #1:  Graphics() objects gets more x20 and y20 when drag is finished, how can I solve it, please?

Any advice would be better for me, please.

Thanks in advance.

extern orgX = 20;
extern orgY = 20;

void OnChartEvent(const int id,const long&lparam,const double&dparam,const string&sparam)
  {
   if(sparam==moveObj)
     {
      if(id==CHARTEVENT_OBJECT_DRAG)
        {
         orgX=(int)ObjectGet(moveObj,OBJPROP_XDISTANCE);
         orgY=(int)ObjectGet(moveObj,OBJPROP_YDISTANCE);
         Graphics();
         // Could I put all of my obj functions here, please?
         // I have a lot of objects and some object names have Order Ticket numbers...
        }
     }
   return;
  }
 

Because externally declared parameters can not be altered, or changed i always copy the external parameter and then change the copy.

Also extern is obsolete, use

input int orgX;

or

static input int orgX;

or 

sinput int orgX;
Reason: