Download MetaTrader 5

PlacePendingorder

To add comments, please log in or register
jens1211
19
jens1211  

Hello,

               //--- check new resistance

               double prevResistance      = symbols[s].lastResistance;

               symbols[s].lastResistance  = SR(symbols[s].name,Timeframes[t].period,4,0);


               //--- new resistance ?

               if(prevResistance!=0 && prevResistance!=symbols[s].lastResistance)

                 {

                  symbols[s].newbar[t]=false;

                  //--- check price

                  if(SymbolInfoDouble(symbols[s].name,SYMBOL_ASK)<symbols[s].lastResistance)

                     symbols[s].SetPlacePending(1,-1,sparams[RS].currentMagic/100);

                 }


               //--- check new support

               double prevSupport         = symbols[s].lastSupport;

               symbols[s].lastSupport     = SR(symbols[s].name,Timeframes[t].period,5,0);


               //--- new support ?

               if(prevSupport!=0 && prevSupport!=symbols[s].lastSupport)

                 {

                  symbols[s].newbar[t]=false;

                  //--- check price

                  if(SymbolInfoDouble(symbols[s].name,SYMBOL_BID)>symbols[s].lastSupport)

                     symbols[s].SetPlacePending(1,1,sparams[RS].currentMagic/100);

                 }

This currently , it places a sell limit on the resistance line and a  buy limit on the support line,


Can someone tell me how to change this code so it places a buystop on that resistance line and a sellstop on that support line?

what part has to get changed 



thanks in advance

nicholishen
1090
nicholishen  
jens1211:

Hello,


               //--- check new resistance

               double prevResistance      = symbols[s].lastResistance;

               symbols[s].lastResistance  = SR(symbols[s].name,Timeframes[t].period,4,0);


               //--- new resistance ?

               if(prevResistance!=0 && prevResistance!=symbols[s].lastResistance)

                 {

                  symbols[s].newbar[t]=false;

                  //--- check price

                  if(SymbolInfoDouble(symbols[s].name,SYMBOL_ASK)<symbols[s].lastResistance)

                     symbols[s].SetPlacePending(1,-1,sparams[RS].currentMagic/100);

                 }


               //--- check new support

               double prevSupport         = symbols[s].lastSupport;

               symbols[s].lastSupport     = SR(symbols[s].name,Timeframes[t].period,5,0);


               //--- new support ?

               if(prevSupport!=0 && prevSupport!=symbols[s].lastSupport)

                 {

                  symbols[s].newbar[t]=false;

                  //--- check price

                  if(SymbolInfoDouble(symbols[s].name,SYMBOL_BID)>symbols[s].lastSupport)

                     symbols[s].SetPlacePending(1,1,sparams[RS].currentMagic/100);

                 }


This currently , it places a sell limit on the resistance line and a  buy limit on the support line,


Can someone tell me how to change this code so it places a buystop on that resistance line and a sellstop on that support line?

what part has to get changed 



thanks in advance


Hi, 

This snippet fragment isn't enough to give you an answer, and next time you post code please use the SRC button in the toolbar. 

Alain Verleyen
Moderator
33803
Alain Verleyen  
jens1211:

Forum on trading, automated trading systems and testing trading strategies

SendMail syntax

Alain Verleyen, 2014.02.11 17:59

Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.

And also please say us what you have tried to do it yourself ?
To add comments, please log in or register