I'm pretty sure this replicates the above next trade order logic (after a signal)? So missing something pretty obvious?
Posts made by bigfoot
-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
This is the code from my original mql file. I'll try and figure it out with with the blocks but I'm a bit confused now!
bool CheckDistance(int type){
GetLastOpenPrice();bool result = false;
int dis =0;if(type==0){
if(LastOpenPrice_Buy>0){
dis = (int)(( LastOpenPrice_Buy - Ask)/myPoint) ;
if(dis > Pip_Distance_Buy) return true;
else return false;
}
else return true;
}
else if(type==1){
if(LastOpenPrice_Sell>0){
dis = (int)((Bid - LastOpenPrice_Sell)/myPoint) ;
if(dis > Pip_Distance_Sell) return true;
else return false;
}
else return true;
}return false;
}void GetLastOpenPrice( )
{
LastOpenPrice_Sell=0;
LastOpenPrice_Buy =0;
int total = OrdersTotal();
if(total==0) return;int opentime_buy=0,opentime_sell=0;
double openprice_buy=0.0,openprice_sell=0;
for(int i = 0; i < total; i++)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) continue;
if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() ) continue;
if(OrderType() == 0){
if(OrderOpenTime()>opentime_buy){
opentime_buy = (int)OrderOpenTime();
openprice_buy=OrderOpenPrice();
}
}
else if(OrderType() == 1){
if(OrderOpenTime()>opentime_sell){
opentime_sell = (int)OrderOpenTime();
openprice_sell=OrderOpenPrice();
}
}
}
LastOpenPrice_Buy = openprice_buy;
LastOpenPrice_Sell = openprice_sell; -
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
So it will only send an order if the price is n pips above or greater than the last open sell order.
-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
Hi thanks, just want to add in extra trades above the previous open sell level. I've tried what you suggested but still adding trades beneath the set "gap"?
-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
OK 1 step forward 2 back...
This should work but it's still not spacing the trades n pips away from last trade? At a loss now

-
RE: Buy Pending Orders in Grid - Keeps Looping - Is this a bug?posted in Questions & Answers
Great stuff, thank you. I'll study it.

-
RE: Buy Pending Orders in Grid - Keeps Looping - Is this a bug?posted in Questions & Answers
Yes it does that but my problem is the 1st pending sell grid trade is opened at the same time. It needs to be n number of pips below the 1st pending BUY. The BUYS are Limits and Sells are Stops.
-
RE: Buy Pending Orders in Grid - Keeps Looping - Is this a bug?posted in Questions & Answers
OK nearly there on this particular challenge. So this now opens the grid as planned, however I would prefer a single buy order to open first and then the grid open beneath it by n pips. i.e. I only want both grids to open after the buy single, hope that makes sense?
-
RE: Buy Pending Orders in Grid - Keeps Looping - Is this a bug?posted in Questions & Answers
Thanks I'll check that

-
Buy Pending Orders in Grid - Keeps Looping - Is this a bug?posted in Questions & Answers
Hi not sure if this is a fault but I've searched on the thread and youtube still can find an answer.
When using buy pending orders in grid (- price from last trade) it resends the buy pending orders again after the 1st one is filled resulting in many duplicate Pending Orders?
Is this a bug or is there an easy fix?
-
Single Trade on 1st Signalposted in Questions & Answers
Hi how do I get only one pass for the 1st signal?
I just want a signal to initiate the grid pending orders but can't figure out how to stop my 1st buy order to only send order once and ignore all subsequent signals?
https://fxdreema.com/shared/wH2nZlMpb
Many thanks
-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
Thanks just working through the add to volume example on the how to pages to see if i can figure it out.
-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
I think my problem is using last open price?
Is this correct when what i want to achieve is for Sell - only open new orders x pips from the order most in current loss (i.e. averaging into the trade)?
-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
Phew.. I thought this would be simple. At least I'm learning I think?
I've tried removing once per bar which should work as the logic of don't trade until n pips awy fromlast trade eliminates the need for it. However when I use Pips away from open price (-n pips for sell) it stops the trades from opening, if I use for each trade this also doesn't work out?
Is there a tutorial on using last open blocks, I can't seem to find one?
https://fxdreema.com/shared/jqQC2JOBd and
https://fxdreema.com/shared/oDjtOTsle -
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
Think I've figured it out, direction mode = chart model and then once per bar under pink block and before sell block. Thanks for your help

-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
Sorry, still finding my way around!
-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
Thank you, I'm still missing something and tried a new block whilst moving the sell under the pink blocks?
-
RE: Distance from last open and only buy/sell above/below last open tradeposted in Questions & Answers
Thank You. This is where I'm at but its still opening trades without the minimum distance, feel like I'm missing something obvious?

