Here is the code snippet am using
Here is the code for the openGrids function.
void openGrids(string ordType, int maxt) { double Bid = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits); double Ask = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits); if(ordType == "buy") { double tp = Ask + 100; //int atrval = grid.atrValue(); if (maxt == 1) { trade.Buy(0.2,NULL,Ask,Ask-30,tp,NULL); } else if (maxt > 1 ) { for(int i= 1; i< maxt+1; i++) { if (i==1) { trade.BuyStop(0.2,Ask+(3*i),_Symbol,Ask-30,Ask+100,ORDER_TIME_GTC,0,NULL); } else { trade.BuyStop(0.2,Ask+(10*i),_Symbol,Ask+(10*i)-30,Ask+100,ORDER_TIME_GTC,0,NULL); } //trade.SellStop(0.2,Ask+(atrval*i),_Symbol,0,0,ORDER_TIME_GTC,0,NULL); } }else { } } else if (ordType == "sell") { //int atrval = grid.atrValue(); double tp = Bid - 100; if (maxt == 1) { trade.Sell(0.2,NULL,Bid,Bid+40,Bid-100,NULL ); } else if (maxt>1) { for(int i= 1; i< maxt+1; i++) { if (i == 1) { trade.SellStop(0.2,Bid-3,_Symbol,Bid+30,Bid-100,ORDER_TIME_GTC,0,NULL); } trade.SellStop(0.2,Bid-(10*i),_Symbol,Bid-(10*i)+30,Bid-100,ORDER_TIME_GTC,0,NULL); } } } }
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