Script buy/selllimit based on SnR...

 

This will be good script, can someone help how to make...

1) Pricegap value automaticaly change to SnR value.. eg : change to S1 value ( based on standard SnR calculation) when attach to the chart.

2) Modify expiry date to the next day only not 24hrs after script drag&drop to the chart.

Please help.

P/s :Original script is not mine.

-----------------------------------

extern double Takeprofit=10;

extern double Pricegap=100; //Want to change this value automaticaly based on Pivot calculation. eg:Support1,S2 or S3

extern double Lot=1;

//+------------------------------------------------------------------+

//| script "send pending order with expiration data" |

//+------------------------------------------------------------------+

int start()

{

int ticket,expiration;

double point;

//----

point=MarketInfo(Symbol(),MODE_POINT);

expiration=CurTime()+PERIOD_D1*60; // Want to change this to next day 00:00:01

//----

while(true)

{

ticket=OrderSend(Symbol(),OP_BUYLIMIT,Lot,Ask-Pricegap*point,0,0,Ask-(Pricegap-Takeprofit)*point,"Buy Limit at S1",16384,expiration,Green);

if(ticket<=0) Print("Error = ",GetLastError());

else { Print("ticket = ",ticket); break; }

//---- 10 seconds wait

Sleep(10);

}

//----

return(0);

}

//+------------------------------------------------------------------+

Files: