How to just Buy or Sell by # of Lots and not have to worry about Order #'s?

 

Hi.


I'm brand new to programming in MT4 and to here, but I searched on the forum and I didn't see any posts that answered my question so here goes.


I am trying to program an EA that buys and sells lots at different amounts as the market changes but does not keep track of the different orders, instead all it keeps track of is how many lots it has purchased and enters and exits the market using Entry Orders. (buy and sell orders) I have been trying to program it into an EA for a while but I really am having a hard time with keeping track of multiple orders and it would be alot easier if instead of multiple orders it just had indicators that would allow it to place market entry orders. Basically the idea of what I am trying to program is simple so I will try and explain it as best as I can so you can get an idea of what I am talking about (sorry if this is rambling, i'm new), just going to tell you in a few steps, then I wrote a sample program in Javascript to help you get an idea of what I am talking about. (I cant seem to get an EA to work with it in MT4 and Im going crazy)


First: you enter the market at the current market price and buy L lots with a target profit of 2P
Case 1) market reaches your target and you make L*2P profit and you exit the market, if this happens dont go onto other stuff because you took a proit and left
Case 2) the market goes down to -4P and then you
  • buy 2L lots at -4P and try to sell them at -2P
  • change your target profit on your first L lots to sell them at P

now 2 things can happen.
thing 1) the market can go back to -2P and you sell your 2L lots
thing 2) the market can drop further down to -8P and in that case buy 2L more lots and sell them at -6P and try to sell your first L lots at no profit

Basically you can continue this process untill you sell all your lots.


I attached a file Idea.html, its just a simple program that generates a Randomwalk and trades off of it with the idea I specified so you can get an idea of what I am trying to make. and you can see why I dont want to deal with multiple Orders that are over-lapping because it is giving me a head-ach and im breaking down and asking for help


I am not asking you to Write an EA or me or anything like that, I just want to know how I can keep track of ONE order and buy and sell without having the program make multiple orders that can conflict with each other.


If you need any clarification just ask, but I think my question is straightforward.

 

Bondy,


FWIW ---- Your suggest algorithm appears to be a Martingale system. My recommendation is that you drop it and consider something better; Martingale systems have a nasty bite and the venom kills.


The Martingale concept is an ill conceived technique derived from a gamblers perspective when the odds are stacked against you. You need to start thinking in the frame of mind that YOU are the "house" and the odds are stacked in your favor, which they will be if you use good money management technique.


The Profit Factor for casinos is only 1.05 to 1.10 depending on the game that is played --- and the casinos are the consistent winners. Here you will be able to achieve PF's over 1.5 frequently and occasionally over 3.0


Once you have a PF of 3.0 and a win/loss percent near 50% you'll never give a Martingale system another thought.


Personally, I won't waste my time coding Martingale systems, and I think that is why a response to your post has been so lightly regarded.


Cheers

 
FXtrader2008:

Bondy,


FWIW ---- Your suggest algorithm appears to be a Martingale system. My recommendation is that you drop it and consider something better; Martingale systems have a nasty bite and the venom kills.


The Martingale concept is an ill conceived technique derived from a gamblers perspective when the odds are stacked against you. You need to start thinking in the frame of mind that YOU are the "house" and the odds are stacked in your favor, which they will be if you use good money management technique.


The Profit Factor for casinos is only 1.05 to 1.10 depending on the game that is played --- and the casinos are the consistent winners. Here you will be able to achieve PF's over 1.5 frequently and occasionally over 3.0


Once you have a PF of 3.0 and a win/loss percent near 50% you'll never give a Martingale system another thought.


Personally, I won't waste my time coding Martingale systems, and I think that is why a response to your post has been so lightly regarded.


Cheers


Thanks :)



I will stick to more standard ways of trading now :)