[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 590

 
alsu:

no big deal.

Try committing /* */ piece of code from the simple Expert Advisor and replace Total with orders_total - the variable we declared ourselves.

I have commented out //Order accounting, replaced Total with orders_total - the orders have not been placed at all.

P. S. Can we open orders at a Stop price in MetaTrader?

Can we change the order type in the condition or the condition itself (I have already tried ask and bid)?

   if (High[0] >= BT)                       // Если разница между
     {                                          // 
      Opn_B=true;                               // Критерий откр. Buy
      Cls_S=true;                               // Критерий закр. Sell
     }
   if (Low[0] <= ST)                       // Если разница между
     {                                          // 
      Opn_S=true;                               // Критерий откр. Sell
      Cls_B=true;                               // Критерий закр. Buy
     }
 
Craft:

I have commented out // Order counting, Total replaced by orders_total - the orders are no longer placed at all.

P. S. Can we open orders at a Stop price in MetaTrader?

Can I change the order type in the condition or the condition itself (I have already tried Ask and Bid)?

I'm starting to get confused. can you post the whole EA code?
 

No problem.

Please note that this code was created for training purposes and there is no practical logic to be found in this form.

Files:
12.mq4  14 kb
 

in the line

BT = Open[0] + Open[0]*iMAOnArray(MyATR[i],0,PerB,0,MODE_SMA,0);

index [i] is redundant. After editing:


Files:
test.mq4  14 kb
 
alsu: After editing:


Since orders are closed before new ones are opened on this tick, the history of closed orders should also be analysed.

corrected in the attachment. Now it is beautiful:)

Files:
test_1.mq4  14 kb
 

For the sake of interest, I tested the test_1 from May 1 to May 28 this year and I want to say that without logic, this expert performs much better than many experts who have plenty of logic =)))


 

Help me solve a problem

I select by all closed positions

for (int i=0; i<OrdersHistoryTotal(); i++)// on all orders of the terminal
if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true)

afterwards filter by magic number

if (OrderMagicNumber()==12)

the filter matches 3 positions but I only need the last closed one

Can't figure out how to leave only the last one?

Thanks

 
Noterday:

For the sake of interest, I tested the test_1 from May 1 to May 28 this year and I want to say that without logic, this expert performs much better than many experts who have YUMA of logic =)))

)))) Thank you Noterday.

Special thanks, alsu.

 

Has anyone used Gannzilla?

What has been the success rate?

 
alsu:

Since on this tick the orders are closed before the new ones are opened, we should also analyse the history of the closed orders.

corrected in attachment. Now that is a beauty:)

There is still one more issue, there are areas where only the closing of a position takes place, not the reversal, although the conditions for a stop and the opening of a new position are the same.


Reason: