Opening positions after X amount of points from bar opening

 
 if (Bar(0) price >200){ 
   OrderSend(Symbol(), OP_BUY, lotSize, Ask,3,stopLoss,magicNumber;
   lastTrade = Time[0];
   
   return;}
   else if (Bar(0) price <200){
   OrderSend(Symbol(), OP_SELL, lotSize, Bid,3,stopLoss,magicNumber;
   lastTrade = Time[0];
   
   return;
   }
Is this code totally illogical? I'll brace myself for a beasting.
  
 

patrick007:

Is this code totally illogical? I'll brace myself for a beasting. 



Please use the SRC button to post code . . .  Click for help --->   SRC
 
patrick007:
Please, try to compile your code before posting. You will see where are problems.
 
angevoyageur:
Please, try to compile your code before posting. You will see where are problems.

I think it's meant to partially be pseudo code,  at least I hope so ;-)
 

Thank you. I did try to use the SRC. I know the code doesn't compile. I want to get the bar function right before I continue further.  

 
patrick007:

Thank you. I did try to use the SRC. I know the code doesn't compile. I want to get the bar function right before I continue further.  

This is how it should look . . 

if (Bar(0) price >200){ 
   OrderSend(Symbol(), OP_BUY, lotSize, Ask,3,stopLoss,magicNumber;
   lastTrade = Time[0];
   
   return;}
   else if (Bar(0) price <200){
   OrderSend(Symbol(), OP_SELL, lotSize, Bid,3,stopLoss,magicNumber;
   lastTrade = Time[0];
   
   return;
   }
 

Is this more logical?

        // Buy Order 
                if(Ask – Open[0] > 150) {




         // Sell Order 
        if (Open[0]-Bid > 150)
                        {
                       
 
patrick007:

Is this more logical?

Nope . . .  perhaps you mean 150 points ?
 
RaptorUK:
Nope . . .  perhaps you mean 150 points ?

Yes, the intention is to open an order if the price is 150 points greater or less than the current bar opening price.
 
patrick007:

Yes, the intention is to open an order if the price is 150 points greater or less than the current bar opening price.
OK,  then that is what you need to code . . .  bear in mind you Open price is a Bid price,  so are High, Low and Close,  doesn't it make sense to compare Bid with Open ?
 
patrick007:

pseudo-code should envelope all variables in the equation and yours seems illogical because its possibly missing some information.

your intention is to open orders when price is greater or lesser than current bar open price, so what is compared?

bar zero open price & what?