Annoying lags?

 

Hey!


Ive been learned for weeks then wrote my first EA that is works great in tester, however the demo account is failing all the times. The thing is that it set to check for a certain Profit value, then stop the Order. Well, it does in the tester as it should, but something is definitely wrong with the demo account, because when it stops the order, a different price will be logged. Am i missed something here? I just cant imagine why it differs from the received profit that i saw in the Trade window... The server lag is ~250msec. That means the round trip is half a second. Thats not much but significant yes, however the profit should not change from $30 to -$3, like it displayed in the indicators!


Did you guys noticed this issue? How to avoid to happen? Its like impossible to write an good and profitable EA because of this...

Thanks for your support.

S

 

lol, u sure its not commision costs?

 
Yes Rebivatui thats absolutely sure. The lag is damn huge, causing the opens and closes placed at different time index, so it gives different end results :( I'm just moving from IB to Aplari, i'll report here if i receive the same issues. Thanks for reading!
 
spockman wrote >>
Yes Rebivatui thats absolutely sure. The lag is damn huge, causing the opens and closes placed at different time index, so it gives different end results :( I'm just moving from IB to Aplari, i'll report here if i receive the same issues. Thanks for reading!

Hi Spockman,

Have you ever figured out the lag problem? It might not be a lag problem, but a position problem. Check the result on the tester. Investigate just one trade, profit or loss, and figure the amount of pips it moved. Only for an example for what I am trying to explain: on the tester it shows 1 pip will equal $30. On the your demo, that same pip equals $3. We are talking leverage here. Just a hunch if I am understanding your question.

Cheers Huckleberry

 

Hello Huckleberry, thanks for visiting my thread. Actually i'm completely droped this idea, and started to working with the StopLoss and TakeProfit's, since they are gets executed on the server (and therefore they are precise). But in the stage when i experienced the issue i used this code to calculate the profit on two pairs that are ran on the same time.



   openorders=0;
   dir1=0;
   dir2=0;
   double pro1,pro2;
   openprofit = 0;
   
   for(int i=0;i<OrdersTotal();i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
      if(OrderSymbol()==pair1)
      {
        openorders+=1;
        if(OrderType()==OP_BUY) dir1=1;
        if(OrderType()==OP_SELL) dir1=-1;
        pro1 = OrderProfit();
      } 
      else if(OrderSymbol()==pair2)
      {
        openorders+=1;
        if(OrderType()==OP_BUY) dir2=1;
        if(OrderType()==OP_SELL) dir2=-1;
        pro2 = OrderProfit();
      }  
      openprofit = openprofit + pro1 + pro2;
   }

I know that OrderProfit(); is returning netto values. But i'm pretty sure that i saw with my eyes that the profit values displayed on the Trade screen was reflected the same that i'm experienced. I saw the overall profit to reaching the $30 limit, then my EA just stoped the execution, but what i'm saw on the history tab was reflected something different (just like -$10 and $5 for example).


Since i'm changed the way the EA is handling the profits, this doesn't really matters, however it is still the issue so. What do you think?

 
spockman wrote >>

Hello Huckleberry, thanks for visiting my thread. Actually i'm completely droped this idea, and started to working with the StopLoss and TakeProfit's, since they are gets executed on the server (and therefore they are precise). But in the stage when i experienced the issue i used this code to calculate the profit on two pairs that are ran on the same time.



I know that OrderProfit(); is returning netto values. But i'm pretty sure that i saw with my eyes that the profit values displayed on the Trade screen was reflected the same that i'm experienced. I saw the overall profit to reaching the $30 limit, then my EA just stoped the execution, but what i'm saw on the history tab was reflected something different (just like -$10 and $5 for example).


Since i'm changed the way the EA is handling the profits, this doesn't really matters, however it is still the issue so. What do you think?

Hello Spockman,

It is good that you will adapt your EA when you see the need, but also good to explore the matters of an issue, that was never resolved. As to understanding your code, thank you for sharing that with me, I still can not get a full grasp at how you are trying to profit. It would be a bit easier if you would use explainations, or definitions of your lines. Such as: dir1=0 //??????????? or any other line in your code.

Use notes in your codes. You know what it is that you want to do. It is difficult for others to help if we do not have a complete understanding. Also, months may go by before you might come back to this script to realize yourself, you can not remember your own exact idea.

Best of Trading to you.

Huckleberry

Reason: