Help Getting Started

 

I am new to coding and am struggling to get started. I have tried for about 7 years to learn VBA, with MS Access databases.

I started with the following advisor.

extern int CapitalSpread = 50;
extern int HedgeValue = 10;
extern double RiskMargin = 10;
extern double TradeVolume = 0.01;


int start()
{
if(OrdersTotal()==0)
{
OrderSend("EURUSD",OP_BUY,TradeVolume,Ask,3,0,0,"",0,0,Green);
Print("Initial Order");
}
if(OrderClosePrice()<(MarketInfo("EURUSD",MODE_BID)-(Point*CapitalSpread)))
{
OrderSend("EURUSD",OP_BUY,TradeVolume,Ask,3,0,0,"",0,0,Blue);
Print("Up ",CapitalSpread," Pips");
}
if(OrderClosePrice()>(MarketInfo("EURUSD",MODE_BID)+(Point*CapitalSpread)))
{
OrderSend("EURUSD",OP_BUY,TradeVolume,Ask,3,0,0,"",0,0,Red);
Print("Down ",CapitalSpread," Pips");
}
return(0);
}

Basically, I want to buy EUR when the price moves 50 pips up or down. When it moves 20 down I want to buy USDJPY and take 100 pips profit.

It should be a simple EA. It does not require a lot of bells and whistles.

Can Anybody help me?

 

W

> Basically, I want to buy EUR when the price moves 50 pips up or down.

Moves 50 in how much time?

What time/s of day are valid?

-BB-

 
BarrowBoy wrote >>

W

> Basically, I want to buy EUR when the price moves 50 pips up or down.

Moves 50 in how much time?

What time/s of day are valid?

-BB-

If it moves up/down 50 pips. Doesn't matter time of day. Even if it takes a week.

I have other problems now. I need to determine my last ticket number. In the strategy tester it worked easily, because the tickets start at 1.

I am thinking now to buy and close a trade on init(). Use that ticket number and decrement it till Symbol()== EURUSD. That would be the last EURUSD order I placed.

Can you then return the LastOrder variable, to be used as an input to start()?