never mind, i'm an idiot and put the take profit in pips i wanted instead of price
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
if (WantLongs==true) { if ( price1 > Ask ) { entermode = OP_BUYSTOP; } else { entermode = OP_BUYLIMIT; } OrderSend(Symbol(),entermode,Lots,price1,0,0,50,GridName,1,0,Green); }and not this:
if (WantShorts==true) { if ( price1 > Bid ) { entermode = OP_SELLLIMIT; } else { entermode = OP_SELLSTOP; } OrderSend(Symbol(),entermode,Lots,price1,0,0,50,GridName,1,0,Red); }I have a simple expert with both of these and it just keeps on opening up buys and no sells, here is the simple expert that should be opening up both buys and sells repeatedly:
//+------------------------------------------------------------------+ //| Test.mq4 | //| | //| | //+------------------------------------------------------------------+ extern double Lots = 0.1; // extern bool WantShorts= true; extern bool WantLongs= true; double price1; int entermode; string Name = "Test"; //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //////////////////////////////// // Open trades //////////////////////////////// price1 = (MathRound((Ask*100)+1)/100); if (WantShorts==true) { if ( price1 > Bid ) { entermode = OP_SELLLIMIT; } else { entermode = OP_SELLSTOP ; } OrderSend(Symbol(),entermode,Lots,price1,0,0,50,Name,1,0,Red); } if (WantLongs==true) { if ( price1 > Ask ) { entermode = OP_BUYSTOP; } else { entermode = OP_BUYLIMIT ; } OrderSend(Symbol(),entermode,Lots,price1,0,0,50,Name,1,0,Green); } return(0); } // the endThanks for any help, I hope it is just something stupid that I am missing, but it is driving me nuts.