placing an Order everyday automatically by an expert

placing an Order everyday automatically by an expert

Manage alerts

Loading saved threads...

samad hamdast · External communityPost link
External question — Stack Overflow Stack Exchange Author: samad hamdast Original post: https://stackoverflow.com/questions/74618821 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. i write an expert in mql4.and i want to place an order(BuyStop Order) everyday at exactly everyday opening. i write the following codes but the expert does not work.please help me // y means yesterday double yHigh=iHigh(Symbol(),PERIOD_D1,1); double yLow=iLow(Symbol(),PERIOD_D1,1); double yOpen=iOpen(Symbol(),PERIOD_D1,1); double yClose=iClose(Symbol(),PERIOD_D1,1); double yRange=yHigh-yLow; double P=NormalizeDouble(((yHigh+yLow+yClose)/3),5); double R3=NormalizeDouble((P+yRange*1.000),5) ; double R2=NormalizeDouble((P+yRange*0.618),5) ; double R1=NormalizeDouble((P+yRange*0.382),5) ; double S1=NormalizeDouble((P-yRange*0.382),5) ; double S2=NormalizeDouble((P-yRange*0.618),5) ; double S3=NormalizeDouble((P-yRange*1.000),5) ; void OnTick() { if (iVolume(Symbol(),PERIOD_D1,0)<=1) int buyTicket=OrderSend(Symbol(),OP_BUYSTOP,0.01,P,3,S1,R1,"MyBuyPosition",7777,0,clrGreen); { // P and R1 and S1 are pivot points and calculated at the top this expert calculates daily Pivot points and place a buystop order at exactly starting the new day.(exactly at starting daily candle) why this Expert does not work? :( i tried more and more.but it does not work.i think there is a problem with line below: if (iVolume(Symbol(),PERIOD_D1,0)<=1) is there the other way to show starting new day instead of this code line??
Quote
Report
PaulB · External communityPost link
External answer — Stack Overflow Stack Exchange Author: PaulB Original post: https://stackoverflow.com/a/74629376 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Using iVolume to determine a new day would be very unreliable. Instead simply use iTime . Try the following: datetime currentDay; void OnTick() { if(currentDay!=iTime(NULL, PERIOD_D1,0)) { int buyTicket=OrderSend(Symbol(),OP_BUYSTOP,0.01,P,3,S1,R1,"MyBuyPosition",7777,0,clrGreen); currentDay=iTime(NULL, PERIOD_D1, 0); } }
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: PaulB Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/a/74629376 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Using iVolume to determine a new day would be very unreliable. Instead simply use iTime . Try the following: datetime currentDay; void OnTick() { if(currentDay!=iTime(NULL, PERIOD_D1,0)) { int buyTicket=OrderSend(Symbol(),OP_BUYSTOP,0.01,P,3,S1,R1,"MyBuyPosition",7777,0,clrGreen); currentDay=iTime(NULL, PERIOD_D1, 0); } }

Cancel quote

Checking account access…