If custom code
-
Hopefully someone can help, my knowledge on mq4 code is limited, I am trying to wright nested if statements, what I am trying to do is:
if variable1=string1 then insert number into variable2, else if variable1=string2 insert a different number into variable2. This continues until match is found or value 0.0 is inserted into variable2.Thankyou
-
@jstap This one is for real programmers. Can someone help?
-

I have tried to implement this code which I think will full full all my needs but I am getting compilation errors (see picture), does anyone have any way I can get this code to compile?
Thanks
-
This is the code:
string Name = Symbol(), Test[] = { "EURUSD", "EURGBP", "USDJPY" };
double Result = 0, Value[] = { 15.0, 20.0, 25.0 };int Count = ArraySize( Test );
for( int i = 0; i < Count; i++ )
{
if( Name == Test[i] )
{
Result = Value[i];
break;
}
} -
@jstap Hello,
I'm not sure in what part of a strategy do you wanna add this, but there are most of the times workarounds with blocks where no custom code is required. I mean here is an example of where you can start with what you asked in the post.

-
@q8carpenter Hi thank you for your time, in this link is where I first tried to have this work and it worked as expected, link text, when I entered it into my main project it wouldn't divide the balance to change the LOT according to balance, I have now learnt that saving balance into a variable allows the needed calculations. Unfortunately I deleted that part so I will have to start again, this was all to make EA automatically start with a predetermined lot for different symbols, custom code would have been the neater option but I will have to build with lots of blocks:)
-
@jstap I see the EA is supposed to trade non forex symbols and they are not included here:

Don't forget to specify their pip rules.
-
@l-andorrà Hi, this EA se set up for all broker pip rules, the reason I am not using acc% vs stop loss is because it closes because of an indicator, nearly all losses happen long before SL is hit so % at risk is less than what would be in EA, I am using SL just for an emergency situation
-
For anyone that is interested, while working on another project I found some of Miro's code for inserting different timeframes into a variable, a little bit of adjusting and it works perfectly for this project. link text