Menu
Brokers
MT4 Forex Brokers
MT5 Forex brokers
PayPal Brokers
Skrill Brokers
Oil Trading Brokers
Gold Trading Brokers
Web Browser Platform
Brokers with CFD Trading
ECN Brokers
Bitcoin FX Brokers
PAMM Forex Brokers
With Cent Accounts
With High Leverage
Cryptocurrency Brokers
Forums
All threads
New threads
New posts
Trending
Search forums
What's new
New threads
New posts
Latest activity
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Reply to thread
Forums
Trading Platforms
MetaTrader 4
Variable , Primitive question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
[QUOTE="Michael-M, post: 196474, member: 66701"] The EA is more than 1000 lines but here a part of EA that I have a problem with, the bold line is the issue that I am facing, its custom function that I have and its act as if it is not being read in the EA because the variable that I have assigned this function to is initialized with -1 although when I change that variable to zero, it works fine, Moreover when I test the function separately out of the EA and assign it to variable that is initialized with -1 , it works as expected and the new value of the function take place of the value of initialization (-1). But still when I try out the function within the EA and just change the initialization value of the variable that the function is assigned to, to be zero it also works fine the issue happens only when the initialization value of the variable is -1 and trying it within the EA I was wondering if someone had the same issue and has explanation to it, [CODE=mql4]double SellPendingLevelOnNewTrend() { int j,z ; int TheDemandTDPointSameLevelOfSupply_BO ; [B] int LevelOfDemandBO=-1,LevelOfSupplyBO =-1;[/B] int Location_FirstTDPoint_OnLevelDemand ; int Location_NxtTDPoint_OnLevelDemand ; int Location_FirstTDPoint_OnLevelSupply ; int Location_NxtTDPoint_OnLevelSupply ; double value ; double PSL_ValueBasedOnSupply_BO ; double PSL_ValueBasedOnDemand_BO ; for(int i=1; i<300; i++) { Location_FirstTDPoint_OnLevelDemand = Get_DemandTD_Location_As_Level(i); Location_NxtTDPoint_OnLevelDemand = Get_NX_DemandTD_Location_As_Level(i); for(j=Location_FirstTDPoint_OnLevelDemand+1 ; j < Location_NxtTDPoint_OnLevelDemand ; j++) { if(Is_DemandTD_Point(j) == true && Level_TDPoint_Demand(j)>Level_TDPoint_Demand(Location_FirstTDPoint_OnLevelDemand)) { LevelOfDemandBO = Level_TDPoint_Demand(j); PSL_ValueBasedOnDemand_BO = iLow(NULL,0, Location_FirstTDPoint_OnLevelDemand); // Print("Level of Demand BO"," ",LevelOfDemandBO," ","Candle Number"," ", j); break; } } if(LevelOfDemandBO > 0) { break; } } //------------------------------------------------------------------------------------------------ for(int i=1; i<300; i++) { Location_FirstTDPoint_OnLevelSupply = Get_SupplyTD_Location_As_Level(i); Location_NxtTDPoint_OnLevelSupply = Get_NX_SupplyTD_Location_As_Level(i); for(z=Location_FirstTDPoint_OnLevelSupply+1 ; z < Location_NxtTDPoint_OnLevelSupply ; z++) { if(Is_SupplyTD_Point(z) == true && Level_TDPoint_Supply(z)>Level_TDPoint_Supply(Location_FirstTDPoint_OnLevelSupply)) { LevelOfSupplyBO = Level_TDPoint_Supply(z); TheDemandTDPointSameLevelOfSupply_BO = Get_DemandTD_Location_As_Level(LevelOfSupplyBO); PSL_ValueBasedOnSupply_BO = iLow(NULL,0,TheDemandTDPointSameLevelOfSupply_BO); // Print("Level of Supply BO"," ",LevelOfSupplyBO," ","Candle Number"," ", z," ", "Demand Candle as Supply Level BO" = TheDemandTDPointSameLevelOfSupply_BO ); break; } } if(LevelOfSupplyBO > 0) { break; } } if(LevelOfSupplyBO < LevelOfDemandBO && LevelOfSupplyBO != 0) { Print("Level of Demand BO"," ",LevelOfDemandBO," ","Candle Number"," ", j, "The candle of PSL loc."," ",Location_FirstTDPoint_OnLevelDemand," ","its value:"," ",PSL_ValueBasedOnDemand_BO); Print("Level of Supply BO"," ",LevelOfSupplyBO," ","Candle Number"," ", z, " The candle of PSL loc."," ",TheDemandTDPointSameLevelOfSupply_BO," ","its value:"," ",PSL_ValueBasedOnSupply_BO); return (PSL_ValueBasedOnSupply_BO); } if(LevelOfDemandBO < LevelOfSupplyBO && LevelOfDemandBO != 0) { Print("Level of Demand BO"," ",LevelOfDemandBO," ","Candle Number"," ", j, "The candle of PSL loc."," ",Location_FirstTDPoint_OnLevelDemand," ","its value:"," ",PSL_ValueBasedOnDemand_BO); Print("Level of Supply BO"," ",LevelOfSupplyBO," ","Candle Number"," ", z, " The candle of PSL loc."," ",TheDemandTDPointSameLevelOfSupply_BO," ","its value:"," ",PSL_ValueBasedOnSupply_BO); return (PSL_ValueBasedOnDemand_BO); } if(LevelOfDemandBO == 0) { Print("Level of Demand BO"," ",LevelOfDemandBO," ","Candle Number"," ", j, "The candle of PSL loc."," ",Location_FirstTDPoint_OnLevelDemand," ","its value:"," ",PSL_ValueBasedOnDemand_BO); Print("Level of Supply BO"," ",LevelOfSupplyBO," ","Candle Number"," ", z, " The candle of PSL loc."," ",TheDemandTDPointSameLevelOfSupply_BO," ","its value:"," ",PSL_ValueBasedOnSupply_BO); return (PSL_ValueBasedOnSupply_BO); } if(LevelOfSupplyBO == 0) { Print("Level of Demand BO"," ",LevelOfDemandBO," ","Candle Number"," ", j, "The candle of PSL loc."," ",Location_FirstTDPoint_OnLevelDemand," ","its value:"," ",PSL_ValueBasedOnDemand_BO); Print("Level of Supply BO"," ",LevelOfSupplyBO," ","Candle Number"," ", z, " The candle of PSL loc."," ",TheDemandTDPointSameLevelOfSupply_BO," ","its value:"," ",PSL_ValueBasedOnSupply_BO); return (PSL_ValueBasedOnDemand_BO); } return (0); } [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Top
Bottom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…