Jump to content

(Ask) How to change logic state of this code


zoop

Recommended Posts

hi my friends,im experimenting with a LSMA indicator to stop an ea trading when in a certain state

 

how would i modify this comment below

 

i need return 1 (allowing trade) in current state or else 0 if not in this state

 

 

 

  if(lsmaga!=EMPTY_VALUE && lsmag!=EMPTY_VALUE)return(0);

if(lsmara!=EMPTY_VALUE && lsmar!=EMPTY_VALUE)return(0);

 

thanks!

Link to comment
Share on other sites

Re: (Ask) How to change logic state of this code

 

It is hard to say anything without seeng the full code, but if you want to close the trades when lsmaga and lsmag are also 0, you can write sg similar:

 

 

if(lsmaga==EMPTY_VALUE && lsmag==EMPTY_VALUE)

{

OrderClose(OrderTicket(),OrderLots(),Bid,10,Red);

return(0);

}

or if you dont want the to open trade you write sg like this in front ordersend:

 

if(lsmaga!=EMPTY_VALUE && lsmag!=EMPTY_VALUE)

{

OrderSend(Symbol(),OP_SELL,lot,Bid,5,Bid+Stop_Loss*Point,Bid-Take_Profit*Point,NULL,0,0,Lime);

return(0);

}

Link to comment
Share on other sites

Re: (Ask) How to change logic state of this code

 

Hi kopaszn,

 

Good day,

 

Thanks a lot for coming by and helping out.

 

That was exactly what I was thinking about to say. :)

 

there is one thing you need to be sure about though, if the broker has 5-digit price, in this case the slippage would be 30 instead of 3. Some broker have special requirements for Slippage. You can check however from the broker itself by asking them through the live chat.

 

Thanks again kopaszn.

 

Best wishes,

a New Year 2011 has come, and the challenge has just started 8-)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...